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

Free Support Forum - aspose.com

Unable to display PDF in iPad

I have the following code written in C# which I want to display as PDF on iPad. It displays as expected in Chrome on Windows, but nothing is displayed on iPad.

Document document = new Document();
Aspose.Pdf.Page page = document.Pages.Add();
page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Hello World!”));

MemoryStream ms = new MemoryStream();
document.Save(ms);

ms.Close();
byte[] data = ms.ToArray();

Response.AddHeader(“Content-Length”, data.Length.ToString());
Response.ContentType = “application/pdf”;
Response.AddHeader(“Accept-Ranges”, “bytes”);
Response.BinaryWrite(data);
Response.Flush();
Response.End();

@steviepca,

Can you please explain your issue in more details. What do you mean by display and how you want to display PDF. What I understood is that you are creating PDF from sample code. Please explain issue so that we may help you out in more details.

I have two web forms in ASP.NET. The main page has a button which when clicked call the second page which should display the PDF that is dynamically generated above. The abbreviated codes shown below:
– Main.aspx –
protected void btnViewReport_Click(object sender, EventArgs e)
{
string script = “window.open(‘ReportDisplay.aspx’, ‘_blank’, ‘resizable=yes,menubar=no,toolbar=no’);”;
ScriptManager.RegisterStartupScript(this, typeof(string), “pdf”, script, true);
}

– ReportDisplay.aspx –
protected void Page_Load(object sender, EventArgs e)
{
License license = new License();
license.SetLicense(“Aspose.Total.lic”);

Document document = new Document();
Aspose.Pdf.Page page = document.Pages.Add();
page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Hello World!”));

MemoryStream ms = new MemoryStream();
document.Save(ms);

ms.Close();
byte[] data = ms.ToArray();

Response.AddHeader(“Content-Length”, data.Length.ToString());
Response.ContentType = “application/pdf”;
Response.AddHeader(“Accept-Ranges”, “bytes”);
Response.BinaryWrite(data);
Response.Flush();
Response.End();
}

@steviepca,

Can you please share screenshot of what is shown in the iPad when you tried to open the PDF.