Hi There
I am trying to scale a pdf and stamping by a certain percentage however the output file is removing the content.
Below is my code
Code 1
====================
Dim pEdit As Aspose.Pdf.Facades.PdfPageEditor = New Aspose.Pdf.Facades.PdfPageEditor()
pEdit.BindPdf(doc)
For Each page As Page In doc.Pages
Try
pEdit.ProcessPages = New Integer() {page.Number}
Dim origPageSize = pEdit.GetPageSize(page.Number)
pEdit.PageSize = origPageSize
pEdit.Zoom = Convert.ToSingle(ComboBox1.Text) / 100.0F '0.9F
pEdit.VerticalAlignmentType = VerticalAlignment.Center
pEdit.HorizontalAlignment = HorizontalAlignment.Center
' pageint += 1
pEdit.Save(A4pdf)
Catch ex As Exception
writer = New StreamWriter(errorlog, True)
If page Is Nothing Then
writer.WriteLine(Now() + " - " + file.ToString + " - Page Number: Unable to get Page Number - " + ex.Message)
Else
writer.WriteLine(Now() + " - " + file.ToString + " - Page Number: " + page.Number.ToString + " " + ex.Message)
End If
writer.Close()
End Try
Next
========================
Code 2
Dim fileeditor As New PdfFileEditor
'fileeditor.ResizeContents(pdfdocument, PdfFileEditor.ContentsResizeParameters.PageResize(pdfdocument.PageInfo.Width, pdfdocument.PageInfo.Height - 15))
Dim parameters As New PdfFileEditor.ContentsResizeParameters(leftMargin:=PdfFileEditor.ContentsResizeValue.Percents(3),
topMargin:=PdfFileEditor.ContentsResizeValue.Percents(3),
bottomMargin:=PdfFileEditor.ContentsResizeValue.Percents(3),
rightMargin:=PdfFileEditor.ContentsResizeValue.Percents(3),
contentsWidth:=Nothing,
contentsHeight:=Nothing)
fileeditor.ResizeContents(pdfdocument, parameters)
===========================
Attached are the samples for before and after PDF’s.
Can you help me investigate and see where I am doing it wrong?
Scale and Stamp.zip (8.1 MB)