Print options for html to PDF

We’re creating a report in HTML then printing to PDF using Aspose.PDF. The Adobe print dialog has a feature with which the user can control whether the current document is printed “as is” (Actual Size), whether it fits the document to the page (Fit), or shrinks the document when necessary (Shrink Oversized Pages). Attached is a screenshot of the options in the dialog. Those seem to default to the last selected option. Is there a way I can control the default value of those options in the document itself?


Related question, the reason I ask the above is that, depending on the options the user selects, my header is getting clipped a little. While I’m forcing a page size of 8.5x11 in my HTML, after the header is added, the actual size of my document is 9.4x11.7. Is there a way of controlling that? I’m producing my header and body separately, and using two documents so the body respects the presence of the header, but the page size isn’t working out.

Thanks
Hi there,

Thanks for your inquiry.


woopsydoo:
We're creating a report in HTML then printing to PDF using Aspose.PDF. The Adobe print dialog has a feature with which the user can control whether the current document is printed "as is" (Actual Size), whether it fits the document to the page (Fit), or shrinks the document when necessary (Shrink Oversized Pages). Attached is a screenshot of the options in the dialog. Those seem to default to the last selected option. Is there a way I can control the default value of those options in the document itself?


I am afraid currently PdfViewer does not support the requested feature. So we have logged an enhancement ticket PDFNEWNET-38716 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

woopsydoo:
Related question, the reason I ask the above is that, depending on the options the user selects, my header is getting clipped a little. While I'm forcing a page size of 8.5x11 in my HTML, after the header is added, the actual size of my document is 9.4x11.7. Is there a way of controlling that? I'm producing my header and body separately, and using two documents so the body respects the presence of the header, but the page size isn't working out.


Please try ScaleFactor property of PdfViewer class to control the print size. If issue persist then please share some sample code and document here. We will look into it and provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

I don’t think PdfViewer is what I’m looking for–correct me if I’m wrong. I’m in a web application. The user clicks a button, the HTML is generated on the server and passed into Aspose.PDF to convert to a PDF, and then it’s streamed down to the client as a document. The browser will pop it open in AdobeReader, and what they do with it after that is up to them–maybe they just want to view it, maybe they save it, maybe they print it. For viewing and saving, everything is fine; it’s only printing that causes a problem because of the page size. Looking for something in the Document that defaults the page size for them.


I’ve experimented with forcing this through the PageInfo of the document, but things aren’t working as expected. If I have a PageInfo in my HtmlLoadOptions when creating the document, the document seems to ignore it. I can set the PageInfo after rendering, but then it seems that my left margin is getting large for no apparent reason. The use of multiple documents is a large part of the problem. I render my HTML body as PDF, then use that to build a new document to which I add a different HTML converted to PDF for the header, then (optionally) do the same for the footer, then do it again so I can lock my checkboxes. Is this the expected way to accomplish these tasks, or is this just a workaround? Do you have a walkthrough of the right way to do this?

Hi there,


Thanks for your feedback. Sorry for the confusion, you are right it is not the PdfViewer related issue but document generation. We will appreciate it if you please share some sample project to replicate the issue at our end. We will look into it and provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,