|
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!
|
|
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!
|
|
Rank: Newbie Groups: Member
Joined: 7/12/2012 Posts: 7
|
Thank you very much for taking the time to explain it.
|
|
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!
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Yeah. That will work. Thank you very much for sharing!
|
|
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?
|
|
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!
|
|
Rank: Newbie Groups: Member
Joined: 7/12/2012 Posts: 7
|
ok, thanks
|
|