Welcome Guest Search | Active Topics | Sign In | Register

Add Subreport pdf to existing PDF Options
B at Diamond Drugs
Posted: Tuesday, September 2, 2014 3:21:57 PM
Rank: Newbie
Groups: Member

Joined: 8/5/2014
Posts: 5
I created a pdf document to store the subreport information (it contains patient information as a header at the top of the document), and I want to add it to another pdf document. This subreport is generated from an SSRS server report. If I do a merge, the subreport document contains a page break, which I don't want. So what is the correct way to go about this?

I generate the report from the report server into a byte array, and then put that into a memory stream which I then create the EO Pdf document from it:
Code: Visual Basic.NET
rptGenerator.Extension = ReportGenerator.ExtensionTypes.PDF
                rptGenerator.ReportServerURL = ConfigurationManager.AppSettings("ReportServerURL")
                rptGenerator.ReportServerReportPath = ConfigurationManager.AppSettings("ReportServerReportPath")
                rptGenerator.ReportName = "rptPAT_FAC_Portrait"

                'Generate Patient Header pdf.
                rptParams.Add(New ReportParameter("PAT_ID", Me.ActivePatientId))
                rptParams.Add(New ReportParameter("CUR_PAGE", "1"))
                rptParams.Add(New ReportParameter("TOT_PAGE", "1"))
                rptParams.Add(New ReportParameter("CHART_DATE", DateTime.Now.ToShortDateString))
                rptGenerator.SetParameters(rptParams)

                PAT_HEADER_BYTES = rptGenerator.GenerateReport()
                'Setup PDF doc of MAR_NEW
                Using ms As MemoryStream = New MemoryStream(PAT_HEADER_BYTES)
                    docPAT_HEADER = New PdfDocument(ms)
                End Using


I merge the two EO.Pdf documents later in the code:
Code: Visual Basic.NET
HtmlToPdf.ConvertHtml(htmlOutput, doc)
                        docCOMPLETE = PdfDocument.Merge(docPAT_HEADER, doc)


But this isn't really what I want. I want *one* document that has the docPAT_HEADER at the top, and the rest of doc after it.

Can you help me? :)
eo_support
Posted: Tuesday, September 2, 2014 8:26:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

I do not believe you can do that with PdfDocument.Merge. When you merge two PDF file with PdfDocument.Merge, the basic merging unit is always page. You can not merge contents from two different pages (either from different PDF files or from the same PDF file) into a single page.

Having that said, most PDF API allows you to add additional contents to an existing page. Our API allows you to do so as well. For example, the following code add additional HTML to your doctPAT_HEADER:

Code: C#
//Set the HTML to PDF output start from the first page, 
//starting Y position at 3 inch from the page top
HtmlToPdf.Options.StartPageIndex = 0;
HtmlToPdf.Options.StartPosition = 3;

//Output HTML into docPAT_HEADER
HtmlToPdf.ConvertHtml(htmlOutput, docPAT_HEADER);


This way you can have HTML output and your header on the same page.

Thanks
B at Diamond Drugs
Posted: Wednesday, September 3, 2014 7:53:38 AM
Rank: Newbie
Groups: Member

Joined: 8/5/2014
Posts: 5
Thanks for getting back to me. I think the easiest solution for me is to add the subheader info as html to the other html (the source for the second document). Then convert the html to the PDF document. Thank you for your help. :)
eo_support
Posted: Wednesday, September 3, 2014 8:32:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Yes. That will work fine too. :)

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.