Forum How do I...?

svg in iframe giving 505 error

rosebud
Hi!
We have some pdf's that we have historically generated in Prince 7. We are now upgrading to Prince 9, and noticed that some SVG's that we were loading via iframes, are now not appearing in the pdf.
I grabbed the html we are sending to the job server and ran it thru prince 9 at the command line, and the error is this:
prince: http://localhost:7003/js/Media/domainCircle?reportable=true&score=5&fillColor=202, 135, 0: error: The requested URL returned error: 505
prince: : error: could not load input file


if I take that exact url from the error, http://localhost:7003/js/Media/domainCircle?reportable=true&score=5&fillColor=202, 135, 0 and put it in a browser, it shows the svg perfectly.

This is how it's laid out in the html
<div class="domainCircle">
                <iframe class="gwt-Frame" src="http://localhost:7003/js/Media/domainCircle?reportable=true&amp;score=6&amp;fillColor=202, 135, 0">
                </iframe>
              </div>



I tried changing all my iframe tags to img tags, but then they displayed as broken links. Any idea about how this would be treated differently from prince7 -> prince 9?

Thank you!
mikeday
Error 505 is unusual, it usually relates to the HTTP version. But perhaps it is being triggered by something else in the request. Are any other requests to that server working from Prince?
mikeday
By the way, which operating system are you running Prince on, and which package did you install?
rosebud
When I run Prince 7 at command line with my html [like our old jobservers had installed]
$ /usr/local/prince-7.1-macosx/lib/prince/bin/prince --baseurl=http://localhost/Sites/ /Users/xxx/Sites/xxx/test.html -o /Users/xxx/Sites/xxx/test.pdf


I get a bunch of errors after each svg link like this:
prince: http://localhost:7003/js/Media/domainCircle?reportable=true&score=6&fillColor=202%2C%20135%2C%200:3: error: Tag svg invalid
prince: http://localhost:7003/js/Media/domainCircle?reportable=true&score=6&fillColor=202%2C%20135%2C%200:4: error: Tag circle invalid
prince: http://localhost:7003/js/Media/domainCircle?reportable=true&score=6&fillColor=202%2C%20135%2C%200:5: error: Tag text invalid
prince: http://localhost:7003/js/Media/xxx?numOfxxx=4&score_1=5&score_1_frequency=2&score_1_date=Aug%2029%2C%2011&score_2=5&score_2_frequency=2&score_2_date=Sep%2028%2C%2011&score_3=5&score_3_frequency=2&score_3_date=Jun%2026%2C%2012&score_4=5&score_4_frequency=2&score_4_date=Mar%2017%2C%2013&withComparison=false&currentSelectedDomain=4&withActivityLines=true&work_1=-1&social_1=-1&sleep_1=-1&work_2=-1&social_2=-1&sleep_2=-1&work_3=4&social_3=3&sleep_3=5&work_4=7&social_4=10&sleep_4=7:90: error: Tag text invalid
prince: warning: failed to load external entity "javascript:''"
prince: : error: could not load input file
prince: warning: failed to load external entity "javascript:''"
prince: : error: could not load input file


but, it creates the PDF with all of the SVGs appearing.



when I run it locally via Prince 9 at command line with my html [like our NEW jobservers have installed]
$ /usr/local/prince-9.0r2-macosx/lib/prince/bin/prince --baseurl=http://localhost/Sites/ /Users/xxx/Sites/xxx/test.html -o /Users/xxx/Sites/xxx/test.pdf 


a handful of SVG's are not appearing in the PDF, such as these:
prince: http://localhost:7003/js/Media/domainCircle?reportable=true&score=8&fillColor=40, 162, 18: error: The requested URL returned error: 505
prince: : error: could not load input file
...
prince: http://localhost:7003/js/Media/xxx?numOfxxx=2&score_1=6&score_1_frequency=2&score_1_date=Aug 29, 11&score_2=5&score_2_frequency=2&score_2_date=Mar 17, 13&withComparison=false&currentSelectedDomain=2: error: The requested URL returned error: 505
prince: : error: could not load input file
prince: javascript:'': error: cannot load unknown URL scheme
prince: : error: could not load input file
prince: javascript:'': error: cannot load unknown URL scheme
prince: : error: could not load input file




This SVG appears in both the Prince7 and Prince9 PDF:

Prince9:
prince: http://localhost:7003/js/Media/xxx?xxx=8&xxx=1&xxx=true&xxx=6&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true: warning: Unknown image MIME type: text/xml



Prince7:
prince: loading document: http://localhost:7003/js/Media/xxx?xxxScore=8&xxxFrequency=1&xxxReportable=true&xxxScore=6&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true&xxxScore=5&xxxFrequency=2&xxxReportable=true

Edited by rosebud

mikeday
Confusing. Would you be able to email me (mikeday@yeslogic.com) the document in question? I won't be able to actually run it here without access to the server, but it will help to untangle exactly which URLs it is trying to access, and why.

The errors coming from Prince 7 like this: "Tag circle invalid" regard inline SVG elements embedded within HTML, which was not well supported in the past. Prince 9 has no problems with this, so there is no error for this situation.

The other 505 errors could possibly be caused by Prince misinterpreting the URL and sending a request that the server doesn't like; we should be able to figure this out from the document.
rosebud
Mike,
I think I solved my problem.
running prince-9.0r2-macosx locally,

with my code like this, the SVG does not appear in my PDF:
<div class="domainCircle">
<iframe class="gwt-Frame" src="http://localhost:7003/js/Media/domainCircle?reportable=true&score=8&fillColor=40, 162, 18">
</iframe>
</div>


however if I strip the spaces out of my "fillColor" and replace them with "%20" the SVG does appear in my PDF:
<div class="domainCircle">
<iframe class="gwt-Frame" src="http://localhost:7003/js/Media/domainCircle?reportable=true&score=8&fillColor=40,%20162,%2018">
</iframe>
</div>


any idea why Prince7 rendered the SVGs with the spaces, and Prince9 is happy when they're %20 instead?

Thank you!


Edited by rosebud

mikeday
There must have been some changes to URL handling, we will take a look.

By the way, the latest Prince alpha version has updated URL handling and HTTP support, and should have no problems with this situation.