I want to generate PDF using FPDF library, but I am facing one issue that I can only provide fixed style and size for all pages. But my requirement is that I should provide dynamic style and size in FPDF object.
What can I try to achieve this?
Use TCPDF
You can find many examples with more features than FPDF. You can use methods to publish some XHTML + CSS code, Javascript and Forms in a PDF format.
Some other features:
custom page formats, custom margins and units of measure;
automatic page header and footer management;
PDF annotations, including links, text and file attachments;
text rendering modes (fill, stroke and clipping);
multiple columns mode;
no-write page regions;
text stretching and spacing (tracking/kerning);
automatic page break, line break and text alignments including justification;
automatic page numbering and page groups;
move and delete pages;
Related
I use evaluation version of evopdf.
Actually, evopdf truncate contains in the render pdf document.
I think that evopdf only render the part of document visible in window browser.
Is your HTML content inside a scrolling area? In this case you have to either create a version of the HTML which displays the entire content inside the scrolling area or set a large custom viewer height in HtmToPdfConverter.HtmlViewerHeight .
For example:
// Create a HTML to PDF converter object with default settings
HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();
// Set HTML viewer height in pixels to convert the top part of a HTML page
// Leave it not set to convert the entire HTML
htmlToPdfConverter.HtmlViewerHeight = 2000;
You can also find the working example with C# source code at http://www.evopdf.com/demo/ where you can test online your HTML page.
I am using AEM 6.0 and want authors to create page using a template having
Page headline
Page sub headline
Page rich text
An image
Page rich text
Similar page - Page with image & RTE
I am planning to use AEM RTE for rich text and as RTE does not provide any option to inset image, i can do one of these
Upgrade RTE to embed image but it will have issues with responsiveness
Create page with multiple RTE and image components to render above output.
Does anyone know best way to achieve this?
For a fixed layout with responsive capabilities you are better off using templates just for simplicity. By fixed layout I am assuming your page will have fixed content location for images and text (guessing from your template details)
Modifying RTE for responsive image insertion on an arbitrary location will not render a good HTML unless you override a lot of RTE functionality. This will be a pain and counter-productive for the use case.
A mid-way alternative is to make a custom image with text (text and image control) where you allow the user to enter text and select and image separately and then provide additional layount options (image position) and responsive customisation.
One more flexible option is to use acs-commons grid layout control to use different text and image controls while letting a grid based css framework (e.g. bootstrap) take care of responsive aspects of the site.
Hope these ideas help you.
My Desktop App is creating a single page pdf with itextsharp library.There are 40 Passport size photos with names under it on a single page.
I need to flatten this pdf page (with 40 photos) as one Image while creating the pdf,currently there are 40 individual photos on the pdf page.I presume it would create around 80 layers by default which would take a very high time on ripping this file for printing on a press.
I dont want to make all the 40 images as one jpeg externally using GDI+ and then lay it in pdf.
I have seen many options using stamper and reading the created pdf file to flatten.Is there a way while creating the pdf i can create a flattened file.
Your understanding of flattening a PDF is completely wrong. The concept of flattening a PDF means: removing all interactivity. For instance: you have a PDF file with form fields. The content of these form fields can be changed in Adobe Reader. When you flatten such a form, you take away the form fields and replace the field content by actual content of the page. The result is a flat PDF in the sense that people can no longer change the content of the fields.
You presume that having multiple pictures on a single page in a PDF means that there are multiple layers in that PDF. Your understanding of layers in a PDF is completely wrong. Layers is a word that is used in many different contexts. For instance, when working with optional content groups (OCG), people often refer to layers.
The concept of layers as you may know it from Photoshop doesn't really exist in PDF. Content is added in a stream. Whatever content is added first, can be covered by content that comes after. You want to pro-process the content by removing all the content that isn't visible in the hope that the PDF will be printed faster. You want to achieve that by replacing many different image objects by one image.
Your assumption that this can be done with iText is wrong. iText doesn't convert PDF to an image. This is outside the scope of what iText is written for.
If you want to add X images as 1 single image using iText, then you have to process the X images into 1 single image before you add the images to the PDF. You need image manipulation software, because iText won't do what you're asking for.
I have PDF template with a large text-box. Based on the size of the content, the textbox comes-up with a vertical scroll bar. But issue comes up when I flatten the PDF using PDFStamper, the text box does not have the scroll bar and user see only half of the content.
Is there way to allow scroll bar in the text box after flatten the pdf?
Please note that while designing the textbox in the template we have enabled scroll bar option.
No. Flattening a PDF effectively disables interactivity. What your printer kicks out is what you see on screen. One work around is to drop the font size on the field for long items. Another option is to make the PDF read-only instead flattening it. See this post from the office iText mailing list for more.
My requirement is like this, I would like to have headers from page 2 of the pdf but not in page 1. Is it possible to do that using css counter and #page?
please check my answer at iText Flying Saucer pdf headers and ignoring html, you can customize the header/footer content based on the page number, i know this is not a answer using flying-saucer. but it works for me.