We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Resized Pdf to Html

Hi,

We’re getting “Invalid type of object” on saving to html when we’ve resized the pdf.
Aspose.Pdf version 17.6, .Net, Windows 7

C#

var pdfEditor = new PdfPageEditor();
pdfEditor.BindPdf(fileStream);

var page = pdfEditor.Document.Pages[1];
var ImageWidth = 640;

var coefficient = ImageWidth / (float)page.GetPageRect(true).Width;
var newHeight = (float)page.GetPageRect(true).Height * coefficient;
pdfEditor.PageSize = new PageSize(ImageWidth, newHeight);
pdfEditor.VerticalAlignmentType = VerticalAlignment.Center;
pdfEditor.HorizontalAlignment = HorizontalAlignment.Center;
pdfEditor.Zoom = coefficient;

var stream = new MemoryStream();
pdfEditor.Save(stream);
new Document(stream).Save(“skanner.html”, new Aspose.Pdf.HtmlSaveOptions());

skanner.pdf (876.7 KB)

@uKaupo,
Thank you for posting the source PDF document and code. We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-42975 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Best Regards,
Imran Rafique