Empty PDF

Hi,

When I’m using the next code (with Aspose.pdf version 9.5.0.0):

Pdf pdf = new Pdf();
Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();
sec1.Paragraphs.Add(new Text(“Hello World…”));
pdf.Save(“Roi.pdf”);

I get an empty Pdf file.
(I think that it’s because of the font…)
Is there something that I’m doing wrong? Is there a way that would allow me to use some base font (that is being recommended by you)?

Thanks,
Roi

Hi Roi,


Thanks for your inquiry. I am afraid I am unable to replicate the issue, while testing your sample code over Windows7 64 bit, VS2010 and Aspose.Pdf for .NET 9.5.0 dll. However if you want to set some font for the Text, you may use following code snippet for the purpose.

Moreover please also check DOM approach to add text in new/existing PDF file. It is more efficient and improved.

Pdf pdf = new Pdf();<o:p></o:p>

Aspose.Pdf.Generator.TextInfo Arial5 = new Aspose.Pdf.Generator.TextInfo();

Arial5.FontName = "Arial";

Arial5.FontSize = (float)5;

Aspose.Pdf.Generator.Section sec = pdf.Sections.Add();

sec.Paragraphs.Add(new Text("Hello World...",Arial5));

pdf.Save(myDir+"Roi.pdf");

Please feel free to contact us for any further assistance.


Best Regards,

Hi Tilal,

Now it works!
Thanks a lot!
Roi

Hi Roi,


Thanks for your feedback. It is good to know that you have managed to resolve the issue.

Please keep using our API and feel free to ask any question or concern. We will be more than happy to extend our support.

Best Regards,