Unable to create PDF via API

Hi,


I am using Aspose.pdf.dll v9.4.0.0 with valid license. Follow the sample code in documentation but unable to create the PDF. All I get is a PDF with empty content and watermark.

Code:

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(“Aspose.Total.lic”);
Aspose.Pdf.Generator.Section sect = pdf.Sections.Add();//new Aspose.Pdf.Generator.Section(pdf);

//foreach (var item in listofstring)
//{
sect.Paragraphs.Add(new Aspose.Pdf.Generator.Text("test test test "));
//}

pdf.Save(@“d:\pdf1.pdf”);

Hi Steven,


Thanks for your inquiry. I have downloaded your shared PDF document. I can see “test test test” text in it without any watermark using Adobe Reader. Furthermore, I also tested your code and it is generating PDF document with the above stated text contents without any issue. Can you please elaborate your issue a bit more and share a console application along with your license file as suggested here? We will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

That would be my reader problem.


I could read it with MS Word.

Here is what I see from my reader. Any idea why it would only show the eval info?

I am on Windows 8.1, using the default pdf reader.

And I how do I add image below the text?


My code below doesnt show the image.

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(“Aspose.Total.lic”);
Aspose.Pdf.Generator.Section sect = pdf.Sections.Add();//new Aspose.Pdf.Generator.Section(pdf);

foreach (var item in listofstring)
{
sect.Paragraphs.Add(new Aspose.Pdf.Generator.Text(item));
}

Aspose.Pdf.Generator.Image image = new Aspose.Pdf.Generator.Image(sect);
sect.Paragraphs.Add(image);
image.ImageInfo.MemoryData = imgBinary;
image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
image.ImageScale = 0.5f;

pdf.Save(@“d:\pdf1.pdf”);
Hi Steven,

sthong80:
That would be my reader problem.

I could read it with MS Word.

Here is what I see from my reader. Any idea why it would only show the eval info?

I am on Windows 8.1, using the default pdf reader.

Thanks for your feedback. Can you please view attached PDF in Win 8.1 default viewer and share the results?

Best Regards,

I can view the content “test test test”

Hi Steven,

sthong80:
And I how do I add image below the text?

My code below doesnt show the image.

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense("Aspose.Total.lic");
Aspose.Pdf.Generator.Section sect = pdf.Sections.Add();//new Aspose.Pdf.Generator.Section(pdf);

foreach (var item in listofstring)
{
sect.Paragraphs.Add(new Aspose.Pdf.Generator.Text(item));
}

Aspose.Pdf.Generator.Image image = new Aspose.Pdf.Generator.Image(sect);
sect.Paragraphs.Add(image);
image.ImageInfo.MemoryData = imgBinary;
image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
image.ImageScale = 0.5f;

pdf.Save(@"d:\pdf1.pdf");

Thanks for your inquiry. I am afraid I am unable to replicate the issue. Your above sample code is working fine. Please find attached sample output for your reference.

Moreover, in your above share screenshot, I see evaluation watermark. So either you are evaluating without a valid license or your license is expired. You may request a 30 days temporary license and test the scenario again. If issue persist then please share a sample console application to replicate the issue at our end.

We are sorry for the inconvenience caused.

Best Regards,