Print Page | Close Window

Problem with SETPDFAMode

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1983
Printed Date: 22 Nov 24 at 7:44PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with SETPDFAMode
Posted By: josepmz
Subject: Problem with SETPDFAMode
Date Posted: 03 Oct 11 at 11:16AM
Hello,

I'm evaluating QuickPDFLibrary, I think that is a very good library. Great Joob.
I've problems with QuickPDFDLL0811.dll in C++ version (MS 2008);
When I try to use SETPDFAMode and save the document, the document is not PDF/A compliance.

Is any limitation with Evaluation Keys?

Any help wold be apreciated Wink

My code:

#include "stdafx.h"
#include "QuickPDFDLL0811.h"


std::wstring Utf8ToUtf16(const std::string &s)
{
    std::wstring ret;
    int len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.length(), NULL, 0);
    if (len > 0)
    {
      ret.resize(len);
      MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.length(), const_cast<wchar_t*>(ret.c_str()), len);
    }
    return ret;
}

std::string Utf16ToUtf8(const std::wstring &s)
{
    std::string ret;
    int len = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), s.length(), NULL, 0, NULL, NULL);
    if (len > 0)
    {
      ret.resize(len);
      WideCharToMultiByte(CP_UTF8, 0, s.c_str(), s.length(), const_cast<char*>(ret.c_str()), len, NULL, NULL);
    }
    return ret;
}

int _tmain(int argc, _TCHAR* argv[])
{
   
    QuickPDFDLL0811 QP(Utf8ToUtf16("QuickPDFDLL0811.dll"));
    int iResult = QP.UnlockKey(Utf8ToUtf16("MyRegKey"));
    QP.SetPDFAMode(2);
    QP.SetOrigin(1);
   
    int fontID1 = QP.AddTrueTypeFont(Utf8ToUtf16("Times New Roman"), 1);   
    QP.SelectFont(fontID1);

    QP.DrawText(25, 25, Utf8ToUtf16("This text was drawn using the DrawText function."));
    if(QP.SaveToFile(Utf8ToUtf16("PDF-A_Document.pdf"))==1)
    {
        _tprintf(_T("grabado\n"));
    }
    else
    {
        _tprintf(_T("no grabado\n"));
    }

    return 0;
}





Replies:
Posted By: Ingo
Date Posted: 03 Oct 11 at 10:34PM
Hi Josep!

Who tells you that the resulting document isn't real PDF/A?
With AddTrueTypeFont you won't EMBED the font and
embedding the used fonts is necessary to get a PDF/A-document.

Cheers and welcome here,
Ingo



Posted By: josepmz
Date Posted: 04 Oct 11 at 8:26AM
Hi Ingo,

My document is not PDF/A beause I don't see legend on Acrobat Reader that says:
"The file you have opened complies with the PDF/A standard and has been opened read-only to prevent modificacion.

My code is based on samples at QuickPDF Library 8.11 console (2.11), on Document Management/Create PDF-A Document. When I run this sample, the PDF/A is correct, but when I run in my Visual Studio 2008 c++ project, it run but is not PDF/A compliance.

When I created this code on QPL console it works fine, and the PDF is PDF/A:

QP.SetPDFAMode(2);
QP.SetOrigin(1);
var fontID1 = QP.AddTrueTypeFont("Times New Roman", 1);
QP.SelectFont(fontID1);
QP.DrawText(25, 25, "This text was drawn using the DrawText function.");
QP.SaveToFile(GetOutputFolder() + "PDF-A_Document.pdf");
DisplayPDFReader(GetOutputFolder() + "PDF-A_Document.pdf");

thanks Ingo, any help would be apreciated.


Posted By: josepmz
Date Posted: 07 Oct 11 at 9:33AM
Hi,

anybody can help me?
I can't create PDF/A documents in Visual Studio 2008 c++ with QuickPdfLibrary 8.11 o 8.12, it seems its ok, but the PDF/A is not created.

My sample code is on firts post.

Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk