Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • tbisof 7 posts 87 karma points
    Aug 12, 2015 @ 10:57
    tbisof
    0

    PDF output problem

    Hello everyone,

    We are experiencing a few issues with our Umbraco site, and would welcome any solutions or fixes you could provide.

    The first problem is that some pages are simply not giving us any PDF output, but instead show an error, for example:

    Data at the root level is invalid. Line 2, position 1.
    
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    
    Exception Details: System.Xml.XmlException: Data at the root level is invalid. Line 2, position 1.
    
    Source Error:
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace:
    
    
    [XmlException: Data at the root level is invalid. Line 2, position 1.]
       ibex4.xml.IntermediateFormatCreator.readXMLIntoIntermediateForm(RenderingContext rc) +405
       ibex4.logical.FODocument_Implementation.commonCreationAndClose(RenderingContext rc, IntermediateFormatCreator intermediate_format_creator, Boolean close_output_stream, Stream output_stream, String xsl_swap_file_name, Stream fo_stream) +56
       ibex4.logical.FODocument_Implementation.generateStreams(Stream xml_stream, Stream xsl_stream, Stream output_stream, Boolean closeOutputStream, Hashtable xsltParams) +1443
       ibex4.logical.FODocument_Implementation.generateStreams(Stream template, Stream output, Boolean closeOutputStream) +99
       FergusonMoriyama.Pdf.Application.Filter.FoFilter.Flush() +96
       FergusonMoriyama.Pdf.Application.Filter.FoFilter.Close() +19
       System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +188
       System.Web.HttpResponse.FilterOutput() +104
       System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +49
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
    

    Some pages output fine, some throw this error, and I've yet to figure out what is causing it. Special characters or improperly formatted HTML don't seem to be the problem.

    Thanks for any help you can provide,

    Tomislav

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 26, 2015 @ 09:09
    Darren Ferguson
    0

    On the first error:

    "Some pages output fine, some throw this error, and I've yet to figure out what is causing it. Special characters or improperly formatted HTML don't seem to be the problem."

    How have you concluded this. Have you removed all content from the affected pages and still have the problem? Have you replaced all content fields in the PDF with static text to see if that works?

    To avoid confusion could you post your second issue as a separate forum topic so that we can correspond on each issue separately.

    Many Thanks.

  • tbisof 7 posts 87 karma points
    Aug 26, 2015 @ 09:49
    tbisof
    0

    So to give you some context - we provide users with the option to generate and download the PDF of a recipe that's displayed on the website. It takes the current content/layout of the recipe and outputs it as PDF.

    At first I thought our content managers unintentionally created the issue by messing up the HTML while writing the recipe inside Umbraco, but I checked it and it's all properly formatted. I even stripped all the classes from it and special characters (we are a Croatian agency so we have letters like šđćčž), but that wasn't the problem either.

    Here are two examples...

    This recipe gives an error when someone tries to download the PDF (the button called Preuzmi Recept):

    http://www.jamnica.hr/hr/jakuham/japamtim/patka-s-mlincima-i-narancom-za-blagdanski-rucak

    This one (and the majority of them) works fine however:

    http://www.jamnica.hr/hr/jakuham/jakreiram/domaci-umaci-za-tjesteninu-u-20-minuta/

    Thanks!

    Tomislav

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 26, 2015 @ 13:20
    Darren Ferguson
    0

    Could you comment out the header that makes the PDF render:

    Response.AppendHeader("X-Pdf-Render","true");
    

    You should then get some XML instead - the FO itself.

    Could you provide that XML here - and also check that it is well formed?

  • tbisof 7 posts 87 karma points
    Aug 27, 2015 @ 07:29
    tbisof
    0

    I've done as you suggested and the output for the bugged recipe is now:

    This page contains the following errors:
    
    error on line 2 at column 1: Document is empty
    Below is a rendering of the page up to the first error.
    

    And then nothing below it. That is very strange.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 27, 2015 @ 08:14
    Darren Ferguson
    0

    Can you attach a screen grab of that please?

  • tbisof 7 posts 87 karma points
    Aug 27, 2015 @ 08:59
  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 27, 2015 @ 11:55
    Darren Ferguson
    0

    Could you remove: Response.ContentType = "text/xsl";

    And see what happens.

    Can you render this page with an alternative HTML template?

    This is going to be pretty difficult to troubleshoot without access to Umbraco.

  • tbisof 7 posts 87 karma points
    Aug 27, 2015 @ 13:25
    tbisof
    0

    It only says:

    Error loading Partial View script (file: ~/Views/MacroPartials/PDF generator.cshtml)
    

    I'll see if we can do anything about access, I'm the front-end guy here so I'm not that great with back-end things, and especially Umbraco.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 27, 2015 @ 13:32
    Darren Ferguson
    0

    If there is an error in the script file you'll need to goto /trace.axd and find the error that occured - or set your macro errors to throw in umbracosettings.config - it doesn't look like this is to do with PDF creator.

    Your Umbraco dev should know how to do this.

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft