Welcome Guest Search | Active Topics | Sign In | Register

Why are we unable to pass multiple urls into one Pdf file Options
Simflex
Posted: Thursday, July 26, 2012 4:41:11 PM
Rank: Newbie
Groups: Member

Joined: 7/12/2012
Posts: 7
Hopefully, someone, anyone can shed some light into this.

We don't need code but just someone to shed some light as why we are unable to pass multiple urls separated by comma to create ONE pdf file.

'sample urls:

default.aspx?doc=meeting&n=1&p=2,default.aspx?doc=milestones&n=1&p=2,default.aspx?doc=prodlaunch&n=1&p=2


'Grab urls into querystring, delimiting each with comma

Dim urlList As String = Request.QueryString("p")
Dim urls() As String = qParams.Split(ChrW(StringSplitOptions.RemoveEmptyEntries))
Response.Write(urlList )

'Create a PdfDocument object
Dim doc As New PdfDocument()

Dim url As String

'loop through the urls
For Each url In urls

'Convert Url(s) into the PdfDocument object
HtmlToPdf.ConvertUrl(url, doc)
'Response.End()
Next

'Save the PDF file
doc.Save("c:\test.pdf")

We thought above code is consistent with the following from your docs:

'Convert three different pages into the same PdfDocument
EO.Pdf.HtmlToPdf.ConvertUrl("c:\1.html", doc)
EO.Pdf.HtmlToPdf.ConvertUrl("c:\2.html", doc)
EO.Pdf.HtmlToPdf.ConvertUrl("c:\3.html", doc)

Again, we would like to know if what we are doing isn't possible.

If anyone feels we are asking for programming help, please ignore this post.

No errors; except only ONE url gets created in the PDF; rest are ignored.

Thank you!
eo_support
Posted: Thursday, July 26, 2012 4:51:01 PM
Rank: Administration
Groups: Administration

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

That's normal. Simply put, using "," to separate multiple Urls is something you invented and the rest of the world doesn't understand yet. In fact because "," is a valid character in Url, so when you put a Url like this:

page1.aspx?q=1,page2.aspx

It can actually be interpreted as:

Page: page1.aspx
Query String Arguments:
q=1,page2.aspx

Note at here the whole remaining portion of the Url "1,page2.apsx" is considered the value of the query string argument "q".

Obviously that's not the way you intended.

Thanks!
Simflex
Posted: Thursday, July 26, 2012 4:52:57 PM
Rank: Newbie
Groups: Member

Joined: 7/12/2012
Posts: 7
Thank you very much for taking the time to explain it.
eo_support
Posted: Thursday, July 26, 2012 5:00:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
You are welcome. Please feel free to let us know if there is anything else.

Thanks!
Simflex
Posted: Thursday, July 26, 2012 9:11:59 PM
Rank: Newbie
Groups: Member

Joined: 7/12/2012
Posts: 7
For anyone else who my "invented" solution may help, the following will convert as many urls as you pass to it.

'Grab urls into querystring, delimiting each with comma
Dim itemsList As String = Request.QueryString("checkedItems")
Dim urls() As String = Split( itemsList , "," )

'Create a PdfDocument object
Dim doc As New PdfDocument()

Dim url As String

'loop through the urls
For Each url In urls

'Convert Url(s) into the PdfDocument object
HtmlToPdf.ConvertUrl(url, doc)
'Response.End()

Next

'Save the PDF file
doc.Save("c:\test.pdf")

Assuming you passed 3 urls, contents of each url will be converted into its separate page but saved into one pdf document.

Hope it helps someone else

eo_support
Posted: Friday, July 27, 2012 8:49:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Yeah. That will work. Thank you very much for sharing!
Simflex
Posted: Monday, July 30, 2012 11:39:20 PM
Rank: Newbie
Groups: Member

Joined: 7/12/2012
Posts: 7
When using this:

doc.Save(Response.OutputStream)

we are able to get "Save filename.pdf" popup. This allows us to save our pdf to whatever name on whatever folder. This works fine in IE but in firefox, we get some unreadable page.

Is this a known issue with firefox?
eo_support
Posted: Tuesday, July 31, 2012 9:19:46 AM
Rank: Administration
Groups: Administration

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

No. FireFox as a popular browser should have no issue with that. You can search online for how to force the browser to display the save as dialog (note some browsers won't honor it anyway, for example, Chrome would display a small download bar at the bottom of the browser window instead of a save as dialog).

Thanks!
Simflex
Posted: Tuesday, July 31, 2012 9:50:25 AM
Rank: Newbie
Groups: Member

Joined: 7/12/2012
Posts: 7
ok, 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.