Rank: Newbie
Groups: Registered
Joined: 5/17/2021(UTC) Posts: 2  Location: Baiersdorf Thanks: 1 times
|
Hi, I have to convert scanned PDF documents to PNG and try to compensate incorrect page orientation from scanning process. Here is an example of my tries. 'result' is always 'true', but the resulting PNG file always has same orientation like the original page in PDF. Code:private static void RotateAndSave(PdfPage pdfPage, float rotation, Int32Size pageSize)
{
FS_RECTF fS_RECTF = new(0, 0, pdfPage.Width, pdfPage.Height);
FS_MATRIX fS_MATRIX = new();
fS_MATRIX.SetIdentity();
fS_MATRIX.Rotate(rotation, true);
bool result = pdfPage.TransformWithClip(fS_MATRIX, fS_RECTF);
using var bitmap = new PdfBitmap(pageSize.Width, pageSize.Height, true);
bitmap.FillRect(0, 0, pageSize.Width, pageSize.Height, FS_COLOR.White);
pdfPage.Render(bitmap, 0, 0, pageSize.Width, pageSize.Height, PageRotate.Normal, RenderFlags.FPDF_LCD_TEXT);
string pngFilename = @"C:\temp\rotated_pdf.png";
bitmap.Image.Save(pngFilename, System.Drawing.Imaging.ImageFormat.Png);
}
Does Lite Edition not support this function? At https://pdfium.patagames...censing_FullAPICalls.htm I found also for Lite: Quote:PDF Page objects capability PDF object access and edit (Get/Set stroke color, Get/Set fill color, transform, copy, clone, bounding box, transparency,…)
Could please anyone help? Tried also with a demo license of Pdfium FULL and it doesn't work either. My environment: VS 2019, 16.9.5; WPF with .NET 5.0 Any ideas? Edited by user Wednesday, May 19, 2021 2:44:52 AM(UTC)
| Reason: Try with FULL Edition also fails.
|