Rank: Newbie Groups: Member
Joined: 3/2/2017 Posts: 8
|
Hi, I have a requirement for "flattening out" an existing PDF.
That is, to convert filled-in form fields into either just "decorated text".
Or, if that is not easy, to convert the pages into images that I can put into a new resulting PDF. In a way, to accomplish what gets done when printing-to-pdf. I've been looking for an API-verb to render a page into an image, but haven't been lucky so far.
Regards Sven
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, You can use our PdfRender class for this purpose: https://www.essentialobjects.com/doc/eo.pdf.pdfrender.aspxOnce you get a list of images (one image per page), you will need to use our API to create new PDF file with these images. One way for you to do so is to create a simple HTML file with all those images and then use our HTML to PDF converter to generate the result PDF file. Another way is to use PDF creator API. The code will be something like this:
Code: C#
PdfDocument doc = new PdfDocument();
for (int i = 0; i < image_count; i++)
{
PdfPage page = doc.Pages.Add();
AcmRender render = new AcmRender(page, 0);
System.Drawing.Image image = System.Drawing.Image.FromFile(image_file_for_page_i);
AcmImage acmImage = new AcmImage(image);
render.Render(acmImage);
}
doc.Save(result_file_name);
In either method, you may need to explicitly set page margins in order to override the default margins. You can look into the documentation for either method for more details on how to do that. If you still have any questions after that please feel free to ask. Thanks
|
Rank: Newbie Groups: Member
Joined: 3/2/2017 Posts: 8
|
Thanks, I'll try that!
|