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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - PDF from SQLite
  FAQ FAQ  Forum Search   Register Register  Login Login

PDF from SQLite

 Post Reply Post Reply
Author
Message
vetal.kw View Drop Down
Beginner
Beginner


Joined: 08 Apr 21
Location: KZ
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote vetal.kw Quote  Post ReplyReply Direct Link To This Post Topic: PDF from SQLite
    Posted: 08 Apr 21 at 7:13AM
Hello!
the file is located in the SQLite database (blob).
how do I save this file to a folder on my computer in Delphi?

procedure TForm3.TabItem4Click(Sender: TObject);
var
  QP: TDebenuPDFLibrary1811;
begin
QP:= TDebenuPDFLibrary1811.Create;
try
  QP.UnlockKey('***************');
  QP.DAOpenFromStream(UniTable1.Fields[2].asString,'');
 QP.SaveToFile('C:\test002.pdf');
finally
  QP.Free;
end;

how can I specify a file from SQLite in "QP. DAOpenFromStream"?




Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 21 at 10:29AM
I would be surprised if your sample code even compiled, because DAOpenFromStream does not take a string as the first parameter. And QPDF has a 'golden rule' not to mix DA and non-DA functions, so if you actually need to use and modify the loaded file in QPDF you would need eventually to save it with DASaveAsFile to match a DA open function.

Your first question, how to save the file to a folder, is not really a QPDF issue. Unfortunately I am not familiar with the UniTable component (perhaps another user here is). But one suggestion would be to try to treat the data as TBytes (an array of bytes), and write that into a MemoryStream which you can SaveToFile, remembering to set the stream position back to 0 before you do. There may well be way get a stream more directly from the blob but you would find examples in your database documentation.

Your second question, how to load it into QPDF, is then simple: once you have the content in a stream, you can then use DAOpenFromStream. I would try to avoid using strings in this process, because this then starts to involve Unicode.

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 21 at 11:47AM
Hi Vetal,

Here you'll find an older post having to do with SQLite. The posted code will give you few hints how to do:
http://www.quickpdf.org/forum/mac-loadfromstring-bug_topic3099_post12428.html?KW=SQLite+Blob#12428

Here's a larger sample with blobs from oracle:
http://www.quickpdf.org/forum/delphi-7-how-to-open-pdf-from-oracle-database_topic2653.html

If you don't need the DA-functions you shouldn't use them cause these functions are only a subset of the large bunch of functions and mixing DA- and normal functions should be avoided.

This is a good starting point to search in the QuickPDF-ressources:
https://www.debenu.com/docs/pdf_library_reference/Search.php

This is a good starting point to learn more about the library:
http://www.quickpdf.org/

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store