Copied to clipboard

Flag this post as spam?

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


  • J 445 posts 862 karma points
    Dec 14, 2017 @ 12:55
    J
    0

    Images not showing

    I've installed PDF creator and ran an example against a test page which has text and images when viewed in a browser.

    Using PDFRazorExample as the template and adding it to the URL always shows the text and no images.

    I then tried the XSLT version (web forms) but doesnt display anything.

    Do i need to do something or does my template need to match some criteria?

    Edit: Just saw the video, Im not sure where im going wrong but possible to have a download of the site and code you showed in your demo so i can see what im doing wrong? None of images, some text and formatting is missing

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 15, 2017 @ 09:20
    Darren Ferguson
    0

    Hi,

    You have to author a template for PDF creator that is specific to your Umbraco document type and properties.

    The examples just assume that the document type has a property called "bodyText" (a bit of an Umbraco convention).

    I'm not sure what you are trying - but PDF creator won't work with HTML templates - you'll need to use the examples to craft a template that will output FO.

    See: https://en.wikipedia.org/wiki/XSLFormattingObjects

  • J 445 posts 862 karma points
    Dec 15, 2017 @ 09:33
    J
    0

    Im using a RichText editor with an alias of CustomContent - i tried changing bodyText to CustomContent but that doesnt work? Do i need another syntax?

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 15, 2017 @ 09:38
    Darren Ferguson
    0

    Could you post a link to your template...

    You'll notice that you also need to parse the content of your rich text area, some basic examples are provided in the sample template.

  • J 445 posts 862 karma points
    Dec 15, 2017 @ 09:44
    J
    0

    Yea i noticed i have to parse it but cant understand why its blank. Im looking at the example atm to see if i can figure this out.

    Its all local but the template is the Razor Example that came with the product and i have added the below lines to get to the content i need

    @ParseRichText(FoHelper.Instance.GetRichTextNodes(@Model.CustomContent))
    @Model.DocumentType.CustomContent
    

    Thanks

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 15, 2017 @ 09:53
    Darren Ferguson
    0

    Couple of hints...

    1. Comment out this:

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

    This'll output the FO XML which will make it a bit easier to debug.

    1. Are you using Visual studio? If so - step through the ParseElement helper with the debugger to see what is happening...
  • J 445 posts 862 karma points
    Dec 15, 2017 @ 12:08
    J
    0

    I am using VS but for some strange reason i cant get into debug mode even though i have

    I can see the XML generated but nothing listed against Document body

    <!--  Document Body  -->
    <fo:flow flow-name="xsl-region-body">
    <fo:block></fo:block>
    

    I'm looking into this a little further but will keep you updated. How could i display images?

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 15, 2017 @ 14:21
    Darren Ferguson
    100

    Threre is an example of rendering images in the example....

      case "img":
              var docRoot = IOHelper.MapPath("~/");
              <fo:block>
                <fo:external-graphic src="@docRoot/@node.Attributes["src"].Value" content-width="9cm"/>
              </fo:block>
              @ParseRichText(node.ChildNodes)
              break;
    
Please Sign in or register to post replies

Write your reply to:

Draft