We are current trying to convert our code for iTextSharp to Aspose.PDF. We are encountering an issue where we cannot find an equivalent line for:
using (var stamper = new PdfStamper(reader, destStream))
{
stamper.AddViewerPreference(PdfName.PICKTRAYBYPDFSIZE, PdfBoolean.PDFTRUE);
}
This sets the checkbox Choose paper source by PDF page size in the printer dialog. Is there an equivalent or a recommended workaround?
Thanks,
Colin
Thank you for your response. However that is not quite what my question was. Our code originally was able to select the “Choose paper source by PDF page size.” My question is does Aspose.PDF have a way to set this through the API?
We have logged an investigation ticket as PDFNET-49934 in our issue tracking system to further analyze whether your requirements are feasible to achieve using the API or not. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We regret to inform you that the earlier logged ticket is not yet resolved. We will surely investigate and resolve it on a first come first serve basis and let you know once is is fixed. Please spare us some time.
We are afraid that the earlier logged ticket could not get resolved due to other issues in the queue. We have recorded your concerns and will surely inform you as soon as we make some progress towards its resolution. Please be patient and spare us some time.
Beginning with Aspose.PDF 24.4 this preference can be switched on and off using the Document.PickTrayByPdfSize property or the PdfContentEditor facade:
using (Document document = new Document())
{
Page page = document.Pages.Add();
page.Paragraphs.Add(new TextFragment("Hello world!"));
// Set the flag to choose a paper tray using the PDF page size
document.PickTrayByPdfSize = true;
document.Save("result.pdf");
}
using (PdfContentEditor contentEditor = new PdfContentEditor())
{
contentEditor.BindPdf("input.pdf");
// Set the flag to choose a paper tray using the PDF page size
contentEditor.ChangeViewerPreference(ViewerPreference.PickTrayByPDFSize);
contentEditor.Save("result.pdf");
}