Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Problem SaveToString / LoadFromString |
Post Reply ![]() |
Author | |
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() Posted: 17 May 06 at 8:56AM |
I need to write/read PDF files into/from a database (Interbase/Firebird).
The best way I see with quicPDF is to convert the PDF into a string (SaveToString), then write this into a BLOB. With LoadFromString it should be possible to recreate the PDF. The first step was no problem (I created a text file as output, and this really contained the content of the PDF). But when I try to load the "text-PDF", the LoadFromString functions returns an error and the TiSEDQuickPDF is empty. ![]() Where is my mistake? |
|
![]() |
|
JanN ![]() Senior Member ![]() Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
![]() ![]() ![]() ![]() ![]() |
Just a thought: Did you try to save that string to file? Is that pdf file accessible by Adobe Reader?
|
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Hello Jan!
My project exported and saved the original PDF to an ASCII string. This file is accessible with Acrobat/Acrobat Reader (both are complaining the 'file is damaged', but they do open correctly). I think I found another (WORKING) way saving PDFs into database (RenderDocumentToFile -> JPG and ExtractFilePageText -> TXT); when reading the "PDF", the JPG will be displayed instead... Main problem is increase of file size (PDF 4kb, JPG 135kb with 150dpi). __________________ Best Regards, Volker |
|
Best Regards,
Volker |
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Finally I found the solution for my problem:
1) Saving each page of the PDF as ASCII with function ExtractFilePageText(sFileName, '', iPage, 2) -> infos for text position, fontsize/font are exported too! 2) Writing this string into database. 3) When reading from database, each line of PDF is added with DrawText. -> a virtual copy of original PDF is displayed! This works fine for me, because my PDF do not contain pictures! |
|
Best Regards,
Volker |
|
![]() |
|
cpri ![]() Team Player ![]() Joined: 17 Feb 06 Location: Netherlands Status: Offline Points: 28 |
![]() ![]() ![]() ![]() ![]() |
Why don't you save the pdf as a BLOB in your database with SaveToStream. code for reading and writing the pdf to and from the database /code procedure TMydbase.read_datasheet(indexnummer:integer); procedure TMydbase.write_datasheet(type_meting,tekeningnr,operator,datum,tijd,bewerking,kommentaar:string;pijp_nr,array_nr,indexnummer_meting:integer);
|
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Thanks Christian, I'll try that next!
|
|
Best Regards,
Volker |
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Hello Christian!
The importing with "SaveToStream"/"LoadFromStream" did NOT work at all, but I sneaked through Interbase/FireBird/IBO documentation and found another possibility... Now I don't need QuickPDF for writing/saving; I can do this like with IB_QWORK do TRY active := FALSE; ParamByName('aID').AsInteger := IDX; ParamByName('aFNAME').AsString := ExtractFileName(sTMP); ParamByName('aDATA').LoadFromFile(sTMP); execSQL; ... EXCEPT ... END; For loading the PDF I can act similar ( FieldByName('DATA').SaveToFile(...)) But Your idea was the final solution (writing BLOB directly)! THANKS! |
|
Best Regards,
Volker |
|
![]() |
|
cpri ![]() Team Player ![]() Joined: 17 Feb 06 Location: Netherlands Status: Offline Points: 28 |
![]() ![]() ![]() ![]() ![]() |
Ok glad you worked it out. I will try the SaveToFile as well. It takes less code and memory So thanks for the tip |
|
![]() |
|
cpri ![]() Team Player ![]() Joined: 17 Feb 06 Location: Netherlands Status: Offline Points: 28 |
![]() ![]() ![]() ![]() ![]() |
Hello ParamByName('Data').LoadFormFile works great but I can't find the function FieldByName('Data').SaveToFile. am I missing something. I'm using the standard Interbase components |
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Hello!
Our company is using Interbase/FireBird as default SQL server database. For database access we have Jason Wharton's great 'IBO' components (InterBase Objects) and these allow FieldByName('xx').SaveToFile. |
|
Best Regards,
Volker |
|
![]() |
|
cpri ![]() Team Player ![]() Joined: 17 Feb 06 Location: Netherlands Status: Offline Points: 28 |
![]() ![]() ![]() ![]() ![]() |
ok It's a pitty the standard interbase components from borland don't support the function. But the methode I use works fine Thanks anyway |
|
![]() |
|
swb1 ![]() Debenu Quick PDF Library Expert ![]() Joined: 05 Dec 05 Location: United States Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
I have never used the interbase components… so I ignorantly ask… Couldn’t you just cast the field component as TBlobfield? i.e.:
Table.FieldByName(‘xyz’) as TBlobField.SaveToFile(FileName); |
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Hi swb1,
of course I could. But inside our BLOBs there are/can be german special characters and with IBO I'm sure (has been tested!) the input and output is correct without additional work. Besides: IBO is very stable, quick and well supported!!! We have been using the "BDE" for some (horrible) years and since we have (mostly) replced BDE with IBO, things have become much better! |
|
Best Regards,
Volker |
|
![]() |
|
ECPVFR ![]() Beginner ![]() ![]() Joined: 17 May 06 Location: Germany Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Hi swb1,
I have tested TBlobField(Query.FieldByName('PDFBLOB')).SaveToFile(sFileName) (with BDE components) and it doesn't work at all! It is showing 'cannot transliterate characters between character sets' even if I set 'transliterate' to FALSE! So I have to use the IBO components (or waste hours/days to get BDE components working somehow...) |
|
Best Regards,
Volker |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store