Zum Hauptinhalt gehen

Suche

Suche

Combining Exportprintpreviewtoimage And Namedsubstring Does Not Give Any Result

Kommentare

4 Kommentare

  • Avatar
    Permanently deleted user

    The "Print" command is intended to actually print a label.  If you are merely trying to set the named substrings, you should try using the <FormatSetup> command instead.  Additionally, that should really come before the <ExportPrintPreviewToImage> command otherwise the preview will be exported prior to the substring values being changed.

     

    <?xml version="1.0" encoding="utf-8"?>
    <XMLScript Version="2.0">
     <Command Name="Job1">
    
    <FormatSetup>
    <Format>D:\Formats\pd02.btw</Format>
    <NamedSubString Name="V19">
    <Value>Test CVE</Value>
    </NamedSubString>
    </FormatSetup>
    
    <ExportPrintPreviewToImage ReturnImageInResponse="true"> 
    <Folder>D:\BTXML\</Folder> 
    <FileNameTemplate>Preview_Label%PageNumber%.jpg</FileNameTemplate> 
    <ImageFormatType>JPG</ImageFormatType> 
    <Colors>btColors24Bit</Colors> 
    <DPI>300</DPI> 
    <Overwrite>true</Overwrite> 
    <IncludeMargins>true</IncludeMargins> 
    <IncludeBorder>true</IncludeBorder> 
    <BackgroundColor>16777215</BackgroundColor> 
    </ExportPrintPreviewToImage> 
    
    </Command>
    
    </XMLScript> 
    

     

    So now loading it and setting the named substrings happens in the first command, and then it is exported.  Try this.

    0
  • Avatar
    Legacy Poster

    Hello Ian,

     

    Thank a lot for your answer.

     

    Unfortunately, it seems that there are a few issues with your answer..

     

    As soon as I remove <Format CloseAtEndOfJob="true">D:\Formats\pd02.btw</Format> from the enclosing ExportPrintPreviewToImage tags, no jpeg file is created.

     

    So, the code below is creating a jpg file, while the one you gave me prints nothing:

     

    Note that text in label is still the default one and NamedSubString has no effect.

    <?xml version="1.0" encoding="utf-8"?>
    <XMLScript Version="2.0">
    <Command Name="Job1">
    <FormatSetup>
    <Format CloseAtEndOfJob="true">D:\Formats\pd02.btw</Format>
    <NamedSubString Name="V19">
    <Value>Test CVE</Value>
    </NamedSubString>
    </FormatSetup>
    <ExportPrintPreviewToImage ReturnImageInResponse="true"> 
    <Format CloseAtEndOfJob="true">D:\Formats\pd02.btw</Format>
    <Folder>D:\BTXML\</Folder> 
    <FileNameTemplate>Preview_Label%PageNumber%.jpg</FileNameTemplate> 
    <ImageFormatType>JPG</ImageFormatType> 
    <Colors>btColors24Bit</Colors> 
    <DPI>300</DPI> 
    <Overwrite>true</Overwrite> 
    <IncludeMargins>true</IncludeMargins> 
    <IncludeBorder>true</IncludeBorder> 
    <BackgroundColor>16777215</BackgroundColor> 
    </ExportPrintPreviewToImage> 
    
    
    </Command>
    
    
    </XMLScript>
     
    0
  • Avatar
    Permanently deleted user

    Sorry, there was still a problem with it.  Go back to my original sample, but note I have removed "CloseAtEndOfJob" from the Format tag.  The name of that tag is misleading, it doesn't close at the end of the "job" but actually at the end of the command, so it was closing the format as soon as it hits the </FormatSetup> tag (that's why the following <Print> command didn't work).

     

    Because the change is not saved, if you close the document in <FormatSetup> and then specify the <Format> tag again in <ExportPrintPreviewToImage> it closes and reopens the document so your change did not take effect.  I've verified that the revised sample does work so if it still seems to not take effect we might have to look at other causes like the substring names not matching up.

    0
  • Avatar
    Legacy Poster

    Thank a lot for your help!

     

    Working fine now.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.