Raw PDF Code to PDF Document - is this possible?

Hi there, I’m currently working on a filemaker solution where one of the actions ivolves obtaining raw pdf code from a website and saving this to a text field in the database. What I would like to know is is there a way to take this raw pdf text code (which I am able to export to a txt file, but not a pdf), and convert this txt file into a pdf document using applescript? Ideally I am going to want to take this raw code, convert it to a pdf, and import this pdf back into a container field.

At the moment the only way I can do this is by manually copy/pasting the raw code into a textwrangler document, and saving with a pdf extension , THEN opening this in preview. Exporting the field contents to a pdf file doesnt allow me to open the file, its not a legitimate pdf.

Any help would be greatly appreciated, thankyou. (so basically a script to take a text file, with pdf code, and turn this code into the actual pdf document, cheers)

Well I looked for a about 2 hours thru my archives of old applescripts, but wasnt able to find what I was looking for.

I used to have a old script that would “build” a blank pdf from a data header and then I would import single page pdfs into the blank to make a multipage pdf, followed with deleting the original blank. I think this was for acrobat 4. But anyway, I got this idea from searching the web. So I would keep trying to search the web for this.