Hi,
There’s a problem that occurs when a document is resized.
Aspose.PDF 22.9.0. The error introduced in 22.5.0 (22.4.0 works okay)
This code fails for the document attached.
var originalDocPath = "doc2.pdf";
var outputPath = "/Users/vad/code/doc2_output.pdf";
//Open PDF Document
var scaledDoc = new Document(originalDocPath);
var scaleFactorPercent = 85;
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
null,
PdfFileEditor.ContentsResizeValue.Percents(scaleFactorPercent),
null,
null,
PdfFileEditor.ContentsResizeValue.Percents(scaleFactorPercent),
null
);
//Resize Page Contents
PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.ResizeContents(scaledDoc, new int[] { 1 }, parameters);
scaledDoc.Save(outputPath);
doc2.pdf (59.1 KB)
The problem appears to be related to this text field
image.png (3.9 KB)
Stack trace
System.InvalidCastException: Unable to cast object of type ‘#=zSxFGcqTS98TiTLFs5WUEvVbg1IsqE5cfLQ==’ to type ‘#=zT8W1SvLcfyjKy4R9Lm61eX3g_l0T7Yp$Vg==’.
at #=zLS$9KpTyQQNMx5cEnWPJcPvwuk5X85iOB5XgftDRlKBYoCFmkg==.#=zBeDr_tc=()
at Aspose.Pdf.Operators.SelectFont.#=z_oWmSmI=(#=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at Aspose.Pdf.Operator…ctor(Int32 #=zLTxr8Fs=, #=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at Aspose.Pdf.Operators.TextOperator…ctor(Int32 #=zLTxr8Fs=, #=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at Aspose.Pdf.Operators.TextStateOperator…ctor(Int32 #=zLTxr8Fs=, #=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at Aspose.Pdf.Operators.SelectFont…ctor(Int32 #=zLTxr8Fs=, #=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at #=zLS$9KpTyQQNMx5cEnWPJcPvwuk5X85iOB5XgftDRlKBYoCFmkg==.#=zCGBq6Tk=(Int32 #=zLTxr8Fs=)
at Aspose.Pdf.Operator.#=z$gtGYzc=(Int32 #=zLTxr8Fs=, #=zUzM1wSMIs8X_Sy2lVGLgOB$BAkQvai7qnUihhrKmnH48 #=zLPipces=)
at Aspose.Pdf.Annotations.DefaultAppearance.#=zyZvbm3A=(#=zDiPV7bQS$Oo0W4S$ZNuC1g2EX6$Ezg75gQ== #=zB95vwcVXoCtJmkkQNw==)
at Aspose.Pdf.Annotations.DefaultAppearance…ctor(#=zDiPV7bQS$Oo0W4S$ZNuC1g2EX6$Ezg75gQ== #=zB95vwcVXoCtJmkkQNw==)
at Aspose.Pdf.Annotations.FreeTextAnnotation.get_DefaultAppearanceObject()
at Aspose.Pdf.Annotations.FreeTextAnnotation.#=z0E47yEKucin1(#=zij_IdK8ZSjpH #=zd_2o2ak=, Annotation #=z$VuuHZI=)
at Aspose.Pdf.Annotations.Annotation.#=zvPw2PcY=(Annotation #=z$VuuHZI=)
at Aspose.Pdf.Annotations.Annotation.#=zDKsGWn5cEk7CmupfaaPRhAk=()
at Aspose.Pdf.Annotations.Annotation.ChangeAfterResize(Matrix transform)
at Aspose.Pdf.Facades.PdfFileEditor.ResizeContents(Document source, Int32[] pages, ContentsResizeParameters parameters)
at PdfResize.Program.Main(String[] args) in Program.cs:line 30