Hello Everyone,
I have one doubt that i am merging two pdf where one is system generated pdf using aspose dll which contains some dynamic data from my system and another my saved pdf document now i want to attached both and save as single pdf.
but the the data comes little croped in second pdf
here i am attaching image of my final out put pdf
my code is like :
Aspose.Pdf.License pdfLic = new Aspose.Pdf.License();
pdfLic.SetLicense(HttpContext.Current.Server.MapPath("~/bin/Aspose.Pdf.lic"));
Document pdfDocument = new Document();
Aspose.Pdf.Page page = pdfDocument.Pages.Add();
page.SetPageSize(PageSize.A4.Width, PageSize.A4.Height);
pdfDocument.ProcessParagraphs();
//page margin to reduce white space from left and right side
page.PageInfo.Margin.Left = 20f;
page.PageInfo.Margin.Right = 20f;
HtmlFragment htmlfragment;
//Header HTML LTHE Logo & Client Logo and Test Sheet name
string HeaderHTML = @"<table style='width:100%'>
<tr>
<td>
<table width='100%' border='1px solid #000' cellspacing='0' style='font-size: 16px;'>
<tr>
<td style='border-right: 1px solid #000; text-align:center; width:25%'><img style='width: 100%;' src='" + HttpContext.Current.Server.MapPath("~/images/Offshore_Logo/Aramco.png") + @"'/></td>
<td style='text-align: center; width:50%'>SAIC - A -2007 <br/> Saudi Aramco Instrumentation Completion <br/> </td>
<td style='border-left: 1px solid #000; text-align:right; width:25%'><img style='width: 100%;' src='" + HttpContext.Current.Server.MapPath("~/images/Offshore_Logo/LTHEEMASLogo.png") + @"'/></td>
</tr>
</table>
<table style='float:right'>
<tr>
<td style='font-weight:bold'>
Revision No:
</td>
<td>
" + revisionNo + @"
</td>
</tr>
</table>
</td>
</tr>
</table>";
if (!string.IsNullOrEmpty(HeaderHTML.ToString()))
{
htmlfragment = new HtmlFragment(HeaderHTML.ToString());
htmlfragment.Margin.Bottom = 20f;
page.Paragraphs.Add(htmlfragment);
}
pdfDocument.ProcessParagraphs();
// Open second document
Document pdfDocument1 = new Document(HttpContext.Current.Server.MapPath(PDF_FilePath));
pdfDocument.Pages.Add(pdfDocument1.Pages);
//Download pdf Code
MemoryStream stream = new MemoryStream();
string Path = HttpContext.Current.Server.MapPath("~/Commissioning/Documents/List/Hasbah/PDF/TEMP/Test.pdf");
pdfDocument.Save(stream);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.AddHeader("Content-Length", stream.Length.ToString());
HttpContext.Current.Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", "Test_TestSheet.pdf"));
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.BinaryWrite(stream.ToArray());
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return string.Empty;
Test_TestSheet (15).pdf (215.0 KB)