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

Free Support Forum - aspose.com

PDF is not getting Opened in Adobe Reader Version 6.(It is urgent Please try to resolve this as soon as possible)

private void ConvertToPDF(DateTime startDate, DateTime endDate, string strkeyWords, char chrFormat, string strStatoilRegion, string newsletterID, string recordIds, bool IsAll)

{

pdfStyle = new clsDataLayerCommonDB();Aspose.Pdf.Pdf document = new Aspose.Pdf.Pdf();

document.Watermarks = pdfStyle.SetSidePDFImage();

try

{

Aspose.Pdf.Section pageSec = document.Sections.Add();

pdfStyle.setSectionSettings(pageSec); // Set PageSectionSettings.

# region Create_Header_Footer pdfStyle.PDFHeader(pageSec, (newsAbbre.Trim() == "TNE") ? Server.MapPath("../images/header-newenergy.png") : (newsAbbre.Trim() == "Russia") ? Server.MapPath("../images/header-media.png") : Server.MapPath("../images/header-unconventional.png"));

pdfStyle.PDFFooter(pageSec);

# endregion

# region News Articlesif (IsAll)

{

_oDSet = _OClsDALCommon.GetRussiaNewsSearchArticleForExport(startDate, endDate, strkeyWords, chrFormat, strStatoilRegion, out MaxNewsArticle, newsletterID);

}

else

{

_oDSet = _OClsDALCommon.GetRussiaNewsArticle(recordIds);

}

if (_oDSet.Tables[0].Rows.Count > 0)

{

Aspose.Pdf.Table tbl = pdfStyle.GetChartHeaderTable();

tbl.Alignment = Aspose.Pdf.AlignmentType.Center;Aspose.Pdf.

Row _row0 = tbl.Rows.Add();Aspose.Pdf.Cell _cell01 = _row0.Cells.Add();

_cell01.Padding.Left = 0;

Aspose.Pdf.Cell _cell02 = _row0.Cells.Add();

Aspose.Pdf.Cell _cell03 = _row0.Cells.Add();

if (IsAll)

{

Aspose.Pdf.Table tblFilter = pdfStyle.GetFilterBodyTable();Aspose.Pdf.MarginInfo mrg = new Aspose.Pdf.MarginInfo();

mrg.Bottom = 5f;

//mrg.Left = 5f;

mrg.Right = 0f;

mrg.Top = 5f;

Aspose.Pdf.Table tblHeader = pdfStyle.GetChartBodyTable();

tblHeader.Margin = mrg;

Aspose.Pdf.Row _rowHeader = tblHeader.Rows.Add();Aspose.Pdf.Cell _cellHeader = _rowHeader.Cells.Add();

Aspose.Pdf.Text tFilterHeader = new Aspose.Pdf.Text("Filter value selected", pdfStyle.StyleForNewsDate());tFilterHeader.IsHtmlTagSupported =

true;

_cellHeader.Paragraphs.Add(tFilterHeader);

_cell02.Paragraphs.Add(tblHeader);

Aspose.Pdf.Row _rowFilter1 = tblFilter.Rows.Add();

Aspose.Pdf.Cell _cellFilter11 = _rowFilter1.Cells.Add();Aspose.Pdf.

Text tSourceType = new Aspose.Pdf.Text("Source Type ", pdfStyle.StyleForNewsArticle());

tSourceType.IsHtmlTagSupported = true;tSourceType.IsSpaced =

true;

//_cellFilter11.Padding = mrg;

_cellFilter11.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter11.Paragraphs.Add(tSourceType);

Aspose.Pdf.Cell _cellFilter12 = _rowFilter1.Cells.Add();

Aspose.Pdf.Text tSourceType1 = new Aspose.Pdf.Text(Convert.ToString(ViewState["NewsLetterName"]), pdfStyle.StyleForNewsArticle());tSourceType1.IsHtmlTagSupported =

true; tSourceType1.IsSpaced = true;

//_cellFilter12.Padding = mrg;

_cellFilter12.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter12.Paragraphs.Add(tSourceType1);

Aspose.Pdf.Row _rowFilter2 = tblFilter.Rows.Add();

_rowFilter2.BackgroundColor = new Aspose.Pdf.Color(244, 244, 245);Aspose.Pdf.

Cell _cellFilter21 = _rowFilter2.Cells.Add();

Aspose.Pdf.Text tStartDate = new Aspose.Pdf.Text("Start Date ", pdfStyle.StyleForNewsArticle());tStartDate.IsHtmlTagSupported =

true; tStartDate.IsSpaced = true;

//_cellFilter21.Padding = mrg;

_cellFilter21.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter21.Paragraphs.Add(tStartDate);

Aspose.Pdf.Cell _cellFilter22 = _rowFilter2.Cells.Add();

Aspose.Pdf.Text tStartDate1 = new Aspose.Pdf.Text(String.Format("{0: MMMM d, yyyy}", startDate), pdfStyle.StyleForNewsArticle());tStartDate1.IsHtmlTagSupported =

true; tStartDate1.IsSpaced = true;

//_cellFilter22.Padding = mrg;

_cellFilter22.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter22.Paragraphs.Add(tStartDate1);

Aspose.Pdf.Row _rowFilter3 = tblFilter.Rows.Add();

Aspose.Pdf.Cell _cellFilter31 = _rowFilter3.Cells.Add();Aspose.Pdf.

Text tEndDate = new Aspose.Pdf.Text("End Date ", pdfStyle.StyleForNewsArticle());

tEndDate.IsHtmlTagSupported = true;tEndDate.IsSpaced =

true;

//_cellFilter31.Padding = mrg;

_cellFilter31.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter31.Paragraphs.Add(tEndDate);

Aspose.Pdf.Cell _cellFilter32 = _rowFilter3.Cells.Add();

Aspose.Pdf.Text tEndDate1 = new Aspose.Pdf.Text(String.Format("{0: MMMM d, yyyy}", endDate), pdfStyle.StyleForNewsArticle());tEndDate1.IsHtmlTagSupported =

true; tEndDate1.IsSpaced = true;

//_cellFilter32.Padding = mrg;

_cellFilter32.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter32.Paragraphs.Add(tEndDate1);

Aspose.Pdf.Row _rowFilter4 = tblFilter.Rows.Add();

_rowFilter4.BackgroundColor = new Aspose.Pdf.Color(244, 244, 245);Aspose.Pdf.

Cell _cellFilter41 = _rowFilter4.Cells.Add();

Aspose.Pdf.Text tStatoilRegion = new Aspose.Pdf.Text("Statoil Region ", pdfStyle.StyleForNewsArticle());tStatoilRegion.IsHtmlTagSupported =

true; tStatoilRegion.IsSpaced = true;

//_cellFilter41.Padding = mrg;

_cellFilter41.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter41.Paragraphs.Add(tStatoilRegion);

Aspose.Pdf.Cell _cellFilter42 = _rowFilter4.Cells.Add();

Aspose.Pdf.Text tStatoilRegion1 = new Aspose.Pdf.Text(Region, pdfStyle.StyleForNewsArticle());tStatoilRegion1.IsHtmlTagSupported =

true; tStatoilRegion1.IsSpaced = true;

//_cellFilter42.Padding = mrg;

_cellFilter42.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter42.Paragraphs.Add(tStatoilRegion1);

Aspose.Pdf.Row _rowFilter5 = tblFilter.Rows.Add();

Aspose.Pdf.Cell _cellFilter51 = _rowFilter5.Cells.Add();Aspose.Pdf.

Text tKeywords = new Aspose.Pdf.Text("Keywords ", pdfStyle.StyleForNewsArticle());

tKeywords.IsHtmlTagSupported = true;tKeywords.IsSpaced =

true;

//_cellFilter51.Padding = mrg;

_cellFilter51.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter51.Paragraphs.Add(tKeywords);

if (!string.IsNullOrEmpty(strkeyWords))

{

int _Offset1;

_Offset1 = Convert.ToString(strkeyWords).Trim().LastIndexOf(',');

if (_Offset1 > 0)

{

strkeyWords = Convert.ToString(strkeyWords).Substring(0, _Offset1).Trim();

}

}

Aspose.Pdf.Cell _cellFilter52 = _rowFilter5.Cells.Add();

Aspose.Pdf.Text tKeywords1 = new Aspose.Pdf.Text(Convert.ToString(strkeyWords), pdfStyle.StyleForNewsArticle());tKeywords1.IsHtmlTagSupported =

true; tKeywords1.IsSpaced = true;

//_cellFilter52.Padding = mrg;

_cellFilter52.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

_cellFilter52.Paragraphs.Add(tKeywords1);

Aspose.Pdf.Table tblFooter = pdfStyle.GetChartBodyTable();

tblFooter.Margin = mrg;

Aspose.Pdf.Row _rowFooter = tblFooter.Rows.Add();

Aspose.Pdf.Cell _cellFooter = _rowFooter.Cells.Add();

string seperator = "
";

Aspose.Pdf.Text tnewsSeparator = new Aspose.Pdf.Text(seperator, pdfStyle.StyleForSeperator());tnewsSeparator.IsHtmlTagSupported =

true;

//tnewsSeparator.IsSpaced = true;

tnewsSeparator.Margin.Top = 0;

tnewsSeparator.Margin.Left = 30;

tnewsSeparator.Margin.Bottom = 2;

_cellFooter.Paragraphs.Add(tnewsSeparator);

_cell02.Paragraphs.Add(tblFilter);

_cell02.Paragraphs.Add(tblFooter);

}

for (int i = 0; i < _oDSet.Tables[0].Rows.Count; i++)

{

Aspose.Pdf.Table tbl1 = pdfStyle.GetChartBodyTable();

tbl1.Alignment = Aspose.Pdf.AlignmentType.Center;

string news_Date = Convert.ToString(_oDSet.Tables[0].Rows[i][0]);

Aspose.Pdf.Text tnewsDate = new Aspose.Pdf.Text("News Date: " + news_Date, pdfStyle.StyleForNewsDate());tnewsDate.IsHtmlTagSupported =

true;tnewsDate.IsSpaced = true;

tnewsDate.Margin.Top = 5;

tnewsDate.Margin.Bottom = 0;

Aspose.Pdf.Row _row3 = tbl1.Rows.Add();

Aspose.Pdf.Cell _cell32 = _row3.Cells.Add();_cell32.Alignment = Aspose.Pdf.

AlignmentType.Left;

//_cell32.Padding = mrg;

_cell32.Paragraphs.Add(tnewsDate);

string newsArticle = Convert.ToString(_oDSet.Tables[0].Rows[i][1]);

Aspose.Pdf.Text tNewArticle = new Aspose.Pdf.Text(newsArticle, pdfStyle.StyleForNewsArticle());tNewArticle.IsHtmlTagSupported =

true;

tNewArticle.Margin.Top = 0;

tNewArticle.Margin.Bottom = 0;

Aspose.Pdf.Row _row1 = tbl1.Rows.Add();

Aspose.Pdf.Cell _cell12 = _row1.Cells.Add();_cell12.Alignment = Aspose.Pdf.

AlignmentType.Left;

_cell12.Paragraphs.Add(tNewArticle);

string NewsSection = Convert.ToString(_oDSet.Tables[0].Rows[i][7]);if (IsNewsSection && !string.IsNullOrEmpty(Convert.ToString(NewsSection)))

{

Aspose.Pdf.Row _row5 = tbl1.Rows.Add();Aspose.Pdf.

Text tNewsSection = new Aspose.Pdf.Text("News Section: " + NewsSection, pdfStyle.StyleForNewsSection());

tNewsSection.IsHtmlTagSupported = true;tNewsSection.IsSpaced =

true;

tNewsSection.Margin.Top = 0;

tNewsSection.Margin.Bottom = 0;

//pageSec.Paragraphs.Add(tnewsDate);

Aspose.Pdf.Cell _cell52 = _row5.Cells.Add(); _cell52.Alignment = Aspose.Pdf.AlignmentType.Left;

//_cell52.Padding = mrg;

_cell52.Paragraphs.Add(tNewsSection);

}

string Company = Convert.ToString(_oDSet.Tables[0].Rows[i][6]);if (IsCompany && !string.IsNullOrEmpty(Convert.ToString(Company)))

{

Aspose.Pdf.Row _row4 = tbl1.Rows.Add();Aspose.Pdf.

Text tCompany = new Aspose.Pdf.Text("Company: " + Company, pdfStyle.StyleForCompany());

tCompany.IsHtmlTagSupported = true;tCompany.IsSpaced =

true;

tCompany.Margin.Top = 0;

tCompany.Margin.Bottom = 0;

//pageSec.Paragraphs.Add(tnewsDate);

Aspose.Pdf.Cell _cell42 = _row4.Cells.Add(); _cell42.Alignment = Aspose.Pdf.AlignmentType.Left;

//_cell42.Padding = mrg;

_cell42.Paragraphs.Add(tCompany);

}

if (IsRegion)

{

Aspose.Pdf.Row _row2 = tbl1.Rows.Add();

string statoil_Region = Convert.ToString(_oDSet.Tables[0].Rows[i][2]);Aspose.Pdf.

Text tstatoilRegion = new Aspose.Pdf.Text("Statoil Region: " + statoil_Region, pdfStyle.StyleForRegion());

tstatoilRegion.IsHtmlTagSupported = true;tstatoilRegion.IsSpaced =

true;

tstatoilRegion.Margin.Top = 0;

tstatoilRegion.Margin.Bottom = 0;

//pageSec.Paragraphs.Add(tstatoilRegion);

Aspose.Pdf.Cell _cell22 = _row2.Cells.Add(); _cell22.Alignment = Aspose.Pdf.AlignmentType.Left;

//_cell22.Padding = mrg;

_cell22.Paragraphs.Add(tstatoilRegion);

}

string NewsLink = Convert.ToString(_oDSet.Tables[0].Rows[i][4]);if (IsNewsSource && !string.IsNullOrEmpty(Convert.ToString(NewsLink)))

{

Aspose.Pdf.Row _row6 = tbl1.Rows.Add();

string[] newsLinkarrary = Regex.Split(NewsLink, "");

string NewsLetter = string.Empty;NewsLetter =

"";for (int j = 1; j < newsLinkarrary.Length; j++)

{

NewsLetter += "";

}

NewsLetter += "

" + newsLinkarrary[0] + "
" + newsLinkarrary[j] + "
";Aspose.Pdf.Text tNewsLinkHeader = new Aspose.Pdf.Text(NewsLetter, pdfStyle.StyleForNewsLink());

tNewsLinkHeader.IsHtmlTagSupported = true;tNewsLinkHeader.IsSpaced =

true;

tNewsLinkHeader.Margin.Top = 0;

tNewsLinkHeader.Margin.Bottom = 0;

Aspose.Pdf.Cell _cell62 = _row6.Cells.Add(); _cell62.Alignment = Aspose.Pdf.AlignmentType.Left;

//_cell62.Padding = mrg;

_cell62.Paragraphs.Add(tNewsLinkHeader);

}

Aspose.Pdf.Row _row7 = tbl1.Rows.Add();Aspose.Pdf.Cell _cell71 = _row7.Cells.Add();

string seperator = "


";Aspose.Pdf.Text tnewsSeparator = new Aspose.Pdf.Text(seperator, pdfStyle.StyleForSeperator()); tnewsSeparator.IsHtmlTagSupported = true;

//tnewsSeparator.IsSpaced = true;

tnewsSeparator.Margin.Top = 0;

tnewsSeparator.Margin.Left = 30;

tnewsSeparator.Margin.Bottom = 0;

_cell71.Paragraphs.Add(tnewsSeparator);

_cell02.Paragraphs.Add(tbl1);

}

pageSec.Paragraphs.Add(tbl);

}

# endregion

string newsLetterName = string.Empty;if (ViewState["NewsLetterName"] != null)

{

newsLetterName = Convert.ToString(ViewState["NewsLetterName"]);

}

document.Save(string.Concat(String.Format("{0: MMMM d, yyyy}", System.DateTime.Now), "_" + newsLetterName, ".pdf"), Aspose.Pdf.SaveType.OpenInAcrobat, Response);

}

catch (Exception ex)

{

throw new ApplicationException(ex.Message);

}

}


This message was posted using Aspose.Live 2 Forum

Hi,

I have tested the scenario using Aspose.Pdf for .NET 4.2.1 and I am unable to notice any problem where I am able to view it in Adobe Reader 7.1.0. In your code you have referenced external methods and objects, so I have modified the code a little bit to execute it. (The updated code and the resultant PDF are in attachment)

Can you please confirm which version of Aspose.Pdf you are using ?

We apologize for your inconvenience.

Hi ,

I am using Aspose PDF version 3:9:0:0

Hi,

Can you please try using the latest version of Aspose.Pdf for .NET 4.2.0 which can be accessed from here. In case you still face any issue, please share the required resources which can help us to generate the same document as you are generating at your end.

We are sorry for your inconvenience.

Hi,

I have tested the scenario and I am able to notice that when resultant PDF is returned to Response object, and issue is occurring while displaying the PDF. For the sake of correction, I have logged it in our issue tracking system as PDFNET-16234. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.