I’m generating pdf files based on database info. I’m not clear why, but currently it appends a single blank page to the end of the completed document. I was hoping to just delete that final blank page, but when I try I get a “stream is not writeable” error.
Here’s how it’s coded right now:
var pdf = new Pdf();
var section = pdf.Sections.Add();
var marginInfo = new Aspose.Pdf.Generator.MarginInfo();
marginInfo.Top = topMargin;
marginInfo.Bottom = marginInfo.Left = marginInfo.Right = MarginOneInch;
section.PageInfo.Margin = marginInfo;
section.TextInfo.FontSize = 12;
section.TextInfo.LineSpacing = 1.5F;
Aspose.Pdf.Generator.Text t = new Text(stringBuilderContainingInfo.ToString());
t.IsHtmlTagSupported = true;
section.Paragraphs.Add(t);
pdf.Save(“c:\someFileName.pdf”);
Document d = new Document(“c:\someFileName.pdf”);
d.Pages.Delete(d.Pages.Count);
d.Save();
Why does this not work?
Hi Scott,
We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for .NET 9.4.0, we have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWNET-37210 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.
Please feel free to contact us for any further assistance.
Best Regards,
Hi Scott,
Apologies for the delay. Please find attached an example document created with the code described above.
Hi Scott,
Hi Scott,
Aspose.Pdf.Document
doc = new Aspose.Pdf.Document();<o:p></o:p>
//add a new page with text and change its page size-ignored
Page page = doc.Pages.Add();
Aspose.Pdf.MarginInfo marginInfo = new Aspose.Pdf.MarginInfo();
marginInfo.Top = 10;
marginInfo.Bottom = marginInfo.Left = marginInfo.Right = 72;
page.PageInfo.Margin = marginInfo;
TextFragment t = new TextFragment("Manufactured on a modern- efficient chassis line and a state of the art cab line using robotic processes and with unmatched confort features, we have made every investment to ensure that the Chief delivers on quality, durability and reliability. We are confident of making significant headway in the fast - growing ABC market - with the new Chief,\" said Robert Gross, TY, Chuck Spencer. Specifically engineered to meet evolving customer expectations in the areas of performance, comfort and realiability, the Chief promises to make our customers more profitable by offering them a tailor-made product solution to meet ther needs and certainly will be a game-changer for them,\" he said.");
t.TextState.FontSize = 12;
t.TextState.LineSpacing = 1.5F;
page.Paragraphs.Add(t);
doc.Save(outFile);
Aspose.Pdf.Document d = new Aspose.Pdf.Document(outFile);
d.Pages.Delete(d.Pages.Count);
string outFile = "c:/pdftest/37210.pdf";
d.Save(outFile);
Hi Scott,
The issues you have found earlier (filed as PDFNEWNET-35804;PDFNEWNET-37210) have been fixed in Aspose.Pdf for .NET 9.5.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi Scott,