Hello
My client has the need to scale down an existing XFA pdf file and then add a "text" at the bottom of the page.
I was wondering if aspose.pdf would be able to handle someting like this (scaling down a file).
Thanks
Hello
My client has the need to scale down an existing XFA pdf file and then add a "text" at the bottom of the page.
I was wondering if aspose.pdf would be able to handle someting like this (scaling down a file).
Thanks
Hi Manny,
Thanks for your inquiry. You can easily resize PDF document pages using Aspose.Pdf. Please check documentation for details and sample code below. Hopefully, it will serve the purpose.
MemoryStream ms = new MemoryStream();
// Create PdfFileEditor Object
PdfFileEditor fileEditor = new PdfFileEditor();
// Open PDF Document
Document doc = new Document(myDir + "XFAForm.pdf");
// Specify Parameter to be used for resizing
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
// left margin = 10% of page width
PdfFileEditor.ContentsResizeValue.Percents(10),
// new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%)
null,
// right margin is 10% of page
PdfFileEditor.ContentsResizeValue.Percents(10),
// top margin = 10% of height
PdfFileEditor.ContentsResizeValue.Percents(20),
// new contents height is calculated automatically (similar to width)
null,
// bottom margin is 10%
PdfFileEditor.ContentsResizeValue.Percents(10)
);
// Resize Page Contents
fileEditor.ResizeContents(doc, new int[] { 1 }, parameters);
// save document to stream.
doc.Save(ms);
// add text watermark at the bottom of page
// Open PDF Document from stream
Aspose.Pdf.Document origPDF = new Aspose.Pdf.Document(ms);
// Create a TextStamp object and set properties
TextStamp txtStamp = new TextStamp("Sample Watermark..");
txtStamp.VerticalAlignment = VerticalAlignment.Bottom;
txtStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
txtStamp.TextState.Font = FontRepository.FindFont("Arial");
txtStamp.TextState.FontSize = 12.0F;
txtStamp.Opacity = 0.5;
// Iterate through all the pages and Set stamp
foreach (Aspose.Pdf.Page pdfpage in origPDF.Pages)
{
pdfpage.AddStamp(txtStamp);
}
// Save final document
origPDF.Save(myDir + "StampedPDFFile.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
Thanks for the fast reply Tilal
I was able to resize the XFA pdf file but it was missing a few things after it was resized.
Example:I have a few radio buttons on the form... when I click a radio button (post resize) the button is not "selected".
The events asscoiated with the radio button do fire... but the radio button isnt visually selected when I click on it
Thanks
Hi Manny,
Here is the XFA document which, after scaling, the radion buttons lose the "selection". However the "click" events behind the radio button do "fire".
Thank you very much
Hi Manny,
Thank you Nayyer
How often do new releases/patches come out?
I was just trying to get an idea to see if the timeframe would work for us...
Hi Manny,
We publish new version of Aspose.Pdf for .NET at the beginning of every month. However, concerning the earlier reported issue, as we have recently been able to notice this issue, and until we have investigated and figured out the actual reasons for this problem, we might not be able to share any timelines by which this problem will be resolved.
However, as soon as we have made some significant progress towards the resolution of this issue, we would be more than happy to update you with the status of correction. Please be patient and spare us some time. Your patience and comprehension are greatly appreciated in this regard.