I have a global container field and inserted a pdf file into it. I'm not able to open it or read it at all. I have it set up as an interactive container. What gives?
Can you export it? If so can you read it then?
Do you just see an icon? It may have been generated without a PDF preview, which is common on Windows computers. Change the view to Image and see if it works. In the Image view it will only show the first page, but sometimes that is all you need. If you have a Mac or Mac Server, you can
Base64Decode ( Base64Encode ( [tablename]::[containerfieldname] ) ; "file.pdf" )
and it will generate the preview automatically.
If you are on Windows, you can change the field to a web viewer instead and view it as a Base64encoded PDF.
Yes - I can export the file and then open and view it and it looks fine.
In the container field, I see the pdf icon. I don't what you mean by "change the view to image..."?
If I used the web viewer instead, I guess I just type the file path?
Just create a web viewer and put this calculation in it substituting in your container field name:
Let ( [
F1 = "data:application/pdf;base64," ;
F2 = [Table Name]::[Container Field Name] ;
F3 = GetAsText ( F2 ) ;
F4 = GetValue ( F3 ; 1 ) ;
F5 = Right ( F4 ; 4 ) ;
F6 = Base64Encode ( F2 ) ;
F7 = If ( F5 = ".pdf" ; F1 & F6 ) )
] ; F7 )
If you have 16+
Base64EncodeRFC ( 4648 ; F2 ) - taking away the <CR><LF> does her in some cases...
Did you use the "Insert File" script step to get the file in the container field? Try the following on the field:
Set Variable [ $fileName ; Value: GetContainerAttribute ( Table::Field ; "fileName" ) ]
Set Variable [ $fileBase64 ; Value: Base64Encode ( Table::Field ) ]
Set Field [ Table::Field ; Base64Decode ( $fileBase64 ; $fileName ) ]
A coworker reminded me of the option on Insert File to display content. That removes the need for Base64.
Retrieving data ...