html to pdf - Create footer with page number not displayed using Document object of EvoPdf -
i have pdf file converted html evopdf htmltopdfconverter. read file bytes evopdf document class , add footer element it. after saving bytes - it's displaying inline webbrowser. footer page number isn't displayed.
this code:
document pdfdoc = new document("myfilepath.pdf"); //create footer element textelement footertext = new textelement(0, 30, "page &p; of &p; ", new system.drawing.font( new system.drawing.fontfamily("arial"), 10, system.drawing.graphicsunit.point)); footertext.embedsysfont = true; footertext.textalign = horizontaltextalign.right; pdfdoc.addfootertemplate(50); pdfdoc.footer.addelement(footertext); byte[] outbuffer = pdfdoc.save(); pdfdoc.close(); //...
if add footer element htmltopdfconverter displayed well.
how can display it?
thanks.
i have run same situation. basically, wanted add header , footer existing pdfs without using htmltopdfconverter.
here solution few tweaks existing code:
//create blank document. document mergedocument = new document(); document pdfdoc = new document("myfilepath.pdf"); //merged n number of existing pdfs newly created document. mergeddocument.appenddocument(pdfdoc, true, true, true); //create footer element textelement footertext = new textelement(0, 30, "page &p; of &p; ", new system.drawing.font( new system.drawing.fontfamily("arial"), 10, system.drawing.graphicsunit.point)); footertext.embedsysfont = true; footertext.textalign = horizontaltextalign.right; //apply footer newly created document after documents appended. mergedocument.addfootertemplate(50); mergedocument.footer.addelement(footertext); byte[] outbuffer = mergedocument.save(); mergedocument.close();
Comments
Post a Comment