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?
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?
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.
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.
Hi there,
Adobe Acrobat provides limited ability to control the default setting for the Size tab using the Print Scaling property of the document, as described in Basic PDF printing tasks - Print at a different size. Setting this property to AppDefault (Default) makes the ‘Shrink oversized pages’ option the default one, while setting it to None sets the ‘Actual size’ option by default. It doesn’t seem possible to use the ‘Fit’ option by default however.
To set the Print Scaling property programmatically, please refer to the following code snippet:
private static void SetPrintScaling()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Add page
document.Pages.Add();
// Setting the PrintScaling.None option makes the 'Actual size' option in the print dialog the default one.
// PrintScaling.AppDefault option corresponds to the 'Shrink oversized pages' option in the print dialog.
document.PrintScaling = PrintScaling.None;
// Save PDF document
document.Save(dataDir + "SetPrintScaling_out.pdf");
}
}