ABCpdf AddImageHtml two html in one page - abcpdf

Is it possible to add two html string in one page ?
When the pdf is rendered, I can only see the second html. It seems that the first one is overwritten

The only way I have found that you can do this is to add each HTML to its own document then merge both documents together
theDoc.AddImageUrl(Url1);
theDoc2.AddImageUrl(Url2);
theDoc.Append(theDoc2);

Related

How do I insert content after new page (automatically generated) or forced page break with dompdf using Twig?

I have created a PDF template that consists simply on a table with a header and multiple rows using Twig to create a PDF through dompdf library.
My problem is that I'm required to insert always another content, specifically a table, after each page with the purpose of having this another table always on the back page when doing duplex printing (in other words, at the end there should be an even number of pages, with the odd ones corresponding to the first table and the even ones corresponding to the inserted table). Do you know if there is a way to achieve this using dompfd or another PDF generation library compatible with Symfony/Twig?
Update: After thinking about other approaches to solve the problem, finally I discovered a library named php-pdftk, that allowed me to create the PDF that I wanted by separating each table into separated PDF's (with dompdf) and then merging both files with the function named "shuffle" (from pdftk), that inserts one page of the first PDF and then one page of the second PDF and so on.
Dompdf can handle the CSS property page-break-*:
.page_break {
page-break-after:always;
}
<h1>Page 1</h1>
...
...
<div class="page_break"></div>
<h1>Page 2</h1>
...
...

Rotativa Issue printing RAW HTML

(More specific Giorgio Bozio)
I have been using Rotativa for the last year to print simple html to pdf and its been working fantastic. Very happy with product, but now recently i have been trying to do something a little more advance and i keep having the same issue.
Normally i would send Rotativa a simple invoice view (Predefined HTML) with model data populated via Razor and this worked well, but now i am trying to implement template's for my invoices. Customers can create their own template layouts with a custom 3rd party form designer and then upload its template file into my site. I take this file and parse it and generate the elements of the invoice with stringbuilder and div tags. I then send the generated HTML to the view that uses a #HTML.Raw() to populate the invoice html. Rotativa then takes this View and generates a pdf, but when it generates the pdf its quality of the text is horrible and blurry. Thus it generates the template correctly, but does some sort of shrinking or something to make the text not look crisp.
I have tried everything, from playing with custom switches to playing with the dimensions of the html.
When i copy the generated html to a view and just generate the pdf plainly then it prints fine, but as soon as i push the html to the view with HTML.Raw i seem to land up with fussy text.
Giorgio Bozio, does Rotativa have a issue with Html.Raw? or can you perhaps open a dialog with me to try and resolve this issue? Really hope you can help me...or someone can help me. Desperate and dont really want to change Rotativa for something else.
Please help.
Resolved Text printing issue by removing background-color definitions on Div containers.
Resolved extra blank page printing issue by reducing PageHeight on Rotativa Customswitches
:-)

Multiple headers, How to get different margin_top value for different pages

In my application, i need create a document pdf in wkhtmltopdf.
There are more than one pages in my document pdf. I generate dynamicly a file html static for header_html specified to the first page and another header_html specified for the rest of page.
My question is the two headers are not the same height:
How can i get margin_top value dynamicly for each page ?
Thank you for your answers.
If you want make your first page is different from the others pages. you can use cover page like:
wkhtmltopdf -H cover cover.html ...
doc

Force a Content to in new page when generating a PDF

Im using play framework and rendering PDF usin rednerPDF() method.
I would like to display some part of content always be in new page.
For Example I have two tables, One table should be in first page and another table should in next page instead of continue from first page. The first table contents are dynamic and we can't sure the height of the table.
Is it possible?
Is it possible?Yes.
You said one table(first one) should be in first page,and again you said its content is dynamic.Now my question is it span over pages and in the next page you want to write second table?This is a generic scenario and what you mentioned is specific one.
You can start trying using two properties of PdfPTable setSplitLate() and setSplitRows()(just google it out for details read Itext In Action).Just keep Two table as two Rows of outer table.set those two property for inner as well as outer in some way as you want(i.e generic case/Specific case).
Another alternative way is use writeSelectedRows() method over PdfContentByte(I don't konw which Object you gonna use for manipulating pdf but you can get it from PdfWriter,*PdfStamper* by using getDirectContent/*UnderContent*/OverContent) after generating table.To use this method you have to set total width of the table so the height can be calculated by method getTotalHeight of PdfPTable.If You use this height properly you absolutely know where your table ends.But all these specific part you have to read & understand first.
With yahp you can use a special html tag to force a page break
<yahp:pb />
we can achieve this by page-break-after:always
Please refer
Alternate to PDF for dynamically generated document with page breaks

Searchable PDF Files (Image+Text PDF) validation

I am checking if a PDF document is searchable if I can get any text from every single page in a PDF.
But checking every page seems to take forever when I am trying to extract text from a PDF that contains more than 500~2000 pages.
Is it possible for a PDF to contain text for one page but not in the rest?
What I am trying to do here is that, if a first page of PDF contains text, then it is a searchable PDF else not..
Yes, it is very possible for a PDF to contain text on one page but not the rest. You could very well have a 500 page PDF that contains images on the first 499 pages, but contain text on the last page.
Unless you want to open the PDF file yourself and scan it for text/text operations, you will need to use an existing third-party PDF library that allows you to extract text from a PDF.
Also, see Ferruccio's response to a related question, which is to use the IFilter interface, specifically made for search indexing and text extraction.
Try this version of Searcharoo, which lets you search Word and PDF documents.

Resources