Forum How do I...?

Creating a PDF out of an ASPX URL with Parameters

LegionArclight
Hi,

I have checked online on the documentation site and cannot find any information regarding this: I am trying to create PDF file using an ASPX URL with parameters. Example of the URL: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3

When I execute "prince -i http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3 -o c:\testpdf.pdf" the following errors were returned:

'Code1' is not recognized as an internal or external command, operable program or batch file.
'Code2' is not recognized as an internal or external command, operable program or batch file.
'Code3' is not recognized as an internal or external command, operable program or batch file.

Does this mean that Prince is unable to process dynamic files and can only process static HTML and (static/dynamic) XML files?

Thanks.
mikeday
You may need to put the URL in quotes. Also, the -i flag is only used to specify the input format, eg. "-i html" or "-i xml", and can usually be omitted.
LegionArclight
Hi Mike,

Thank you, the quotation marks worked.

Now, when executing prince on the URL with quotation marks, the PDF file was generated but the following errors were returned:

C:\Program Files\Prince\Engine\bin>prince "http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3" -o c:\output.pdf

prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: htmlParseEntityRef: no name
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bcDateTime2 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID NewPage already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bp120 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bcDateTime2 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bcP120 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: htmlParseEntityRef: no name
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bcDateTime2 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:18: error: ID bcP120 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:20: error: ID NewPage already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:20: error: ID bp120 already defined
prince: http://testsite/generatefile.aspx?Code1=1&Code2=2&Code3=3:20: error: ID bp120 already defined

C:\Program Files\Prince\Engine\bin>


The generatefile.aspx is a page that loops itself to generate a few pages of info based on the parameter values entered. Could this be because since the page loops itself, Prince validates the HTML content of the page prior to the creation of the PDF file? Since the PDF file was created, should the errors above be ignored?

Thank you.
mikeday
If the PDF looks okay then the errors can be ignored. The entity ref error relates to unescaped ampersands, which need to be escaped as & in HTML documents. The ID errors refer to repeated ID attribute values; IDs are supposed to be unique in HTML documents.