*PROCEDURE PDFCREATOR
local m.report_filename, m.pdf_filename, m.pdf_passwordm.report_filename = "C:\MiaApp\Reports\MioReport"m.pdf_filename = "C:\MiaApp\Stampe\MiaStampa.PDF"m.pdf_password = "" && "MiaPassword"m.pdf_author = "Autore"
select MiaTabella
do STAMPA_PDF with m.report_filename, m.pdf_filename, m.pdf_password, m.pdf_author
RETURN*PROCEDURE STAMPA_PDFparameters m.pp_report_filename, m.pp_pdf_filename, m.pp_pdf_password, m.pp_pdf_author
private loPDFCreatorloPDFCreator = NULL
local PDFCreatorVersionPDFCreatorVersion = PDFCREATOR_VERSION()
if PDFCreatorVersion = 0 RETURNendif
private m.directory, m.filenamem.directory = addbs(iif(! empty(justpath(m.pp_pdf_filename)), justpath(m.pp_pdf_filename), set("default") + curdir()))m.filename = justfname(m.pp_pdf_filename)
if file(m.directory + m.filename) local lnResponse lnResponse = 0
do while .t. try erase (m.directory + m.filename) recycle catch endtry
if ! file(m.directory + m.filename) EXIT endif
lnResponse = messagebox( ; "Attenzione!" + chr(13) + chr(13) + ; "Non riesco a cancellare il file " + m.filename + chr(13) + ; "contenuto nella cartella " + m.directory, ; 5 + 48 + 0, "Crea PDF con PDFCreator", 3000)
if lnResponse = 2 EXIT endif enddo
if lnResponse = 2 RETURN endifendif
do casecase PDFCreatorVersion > 210 do STAMPA_PDF_200case PDFCreatorVersion = 210 do STAMPA_PDF_200 with "Beta"case PDFCreatorVersion = 200 do STAMPA_PDF_200 with "Beta"case PDFCreatorVersion = 173 do STAMPA_PDF_173endcase
RETURN*FUNCTION PDFCREATOR_VERSION
local PDFCreatorVersionPDFCreatorVersion = 0
if PDFCreatorVersion = 0 PDFCreatorVersion = 220
*local loPDFCreator as PDFCreator.PDFCreatorObj
try loPDFCreator = CreateObject("PDFCreator.PDFCreatorObj") catch PDFCreatorVersion = 0 endtryendif
if PDFCreatorVersion = 0 PDFCreatorVersion = 210
*local loPDFCreator as PDFCreatorBeta.PDFCreatorObj
try loPDFCreator = CreateObject("PDFCreatorBeta.PDFCreatorObj") catch PDFCreatorVersion = 0 endtryendif
if PDFCreatorVersion = 0 PDFCreatorVersion = 200
*local loPDFCreator as PDFCreatorBeta.PDFCreator
try loPDFCreator = CreateObject("PDFCreatorBeta.PDFCreator") catch PDFCreatorVersion = 0 endtryendif
if PDFCreatorVersion = 0 PDFCreatorVersion = 173
*local loPDFCreator as PDFCreator.clsPDFCreator
try loPDFCreator = CreateObject("PDFCreator.clsPDFCreator") catch PDFCreatorVersion = 0 endtryendif
RETURN PDFCreatorVersion*PROCEDURE STAMPA_PDF_200lparameters m.beta_version
do casecase empty(m.beta_version) m.beta_version = ""case ! empty(m.beta_version) m.beta_version = "Beta"endcase
*local loPDFCreator as PDFCreator.PDFCreatorObj*loPDFCreator = CreateObject("PDFCreator.PDFCreatorObj")
*local loPDFCreator as PDFCreatorBeta.PDFCreatorObj*loPDFCreator = CreateObject("PDFCreatorBeta.PDFCreatorObj")
*local loPDFCreator as PDFCreatorBeta.PDFCreator*loPDFCreator = CreateObject("PDFCreatorBeta.PDFCreator")
local lnResponselnResponse = 0
do while loPDFCreator.IsInstanceRunning
lnResponse = messagebox( ; "Attenzione!" + chr(13) + chr(13) + ; "Per poter proseguire è prima necessario chiudere PDFCreator!", ; 5 + 48 + 0, "Crea PDF con PDFCreator", 3000) * Riprova 4, Annulla 2
if lnResponse = 2 EXIT endifenddo
if lnResponse = 2 RETURNendif
local loPDFCreatorQueue as PDFCreator.JobQueuelocal loPDFCreatorQueue as PDFCreatorBeta.JobQueueloPDFCreatorQueue = CreateObject("PDFCreator" + m.beta_version + ".JobQueue")loPDFCreatorQueue.Initialize()
local m.old_printerm.old_printer = set("PRINTER", 3)
set printer to name "PDFCreator"
report form (m.pp_report_filename) to printer noconsole
set printer to name (m.old_printer)
do while ! loPDFCreatorQueue.WaitForJob(0.1) doevents wait window nowait "Attesa creazione file 1 ..."enddowait clear
local loPDFCreatorJob as loPDFCreatorQueue.NextJob
do while .t. loPDFCreatorJob = loPDFCreatorQueue.NextJob if ! isnull(loPDFCreatorJob) EXIT endif doevents wait window nowait "Attesa creazione file 2 ..."enddowait clear
* 4. Setup the profile of the job with SetProfileByGuid(guid).* The guid parameter is a string type that is used to assign the apropriate conversion profile(see enumeration below).* Note: Alternatively, you can use SetProfileByName("MyNameForACertainProfile").* For the standard profiles it holds that their guids are equal to their names.* 49. job.SetProfileByGuid("DefaultGuid")* Alternative:* job.SetProfileByName("DefaultGuid")* Guids:* "DefaultGuid" (for conversions to pdf-files)* "PrintGuid" (for printing after conversion)* "HighCompressionGuid"(for highly compressed files)* "HighQualityGuid" (for high quality files)* "JpegGuid" (for conversions to jpeg-files)* "PngGuid" (for conversion to png-files)* "TiffGuid" (for conversions to tif-files)* "PdfaGuid" (for conversions to pdfa-files)
loPDFCreatorJob.SetProfileByGuid("DefaultGuid")*loPDFCreatorJob.SetProfileByName("DefaultGuid")
*loPDFCreatorJob.SetProfileSetting("AutoSave.Enabled", "True")*loPDFCreatorJob.SetProfileSetting("AutoSave.EnsureUniqueFilenames", "False")*loPDFCreatorJob.SetProfileSetting("AutoSave.Enabled", "False")
loPDFCreatorJob.SetProfileSetting("OpenViewer", "False")loPDFCreatorJob.SetProfileSetting("ShowProgress", "False")loPDFCreatorJob.SetProfileSetting("TitleTemplate", juststem(m.filename))
if ! empty(m.pp_pdf_author) loPDFCreatorJob.SetProfileSetting("AuthorTemplate", m.pp_pdf_author)endif
if ! empty(m.pp_pdf_password) loPDFCreatorJob.SetProfileSetting("PdfSettings.Security.Enabled", "True") && If true, the PDF file will be password protected loPDFCreatorJob.SetProfileSetting("PdfSettings.Security.EncryptionLevel", "Aes128Bit") && Defines the encryption level. Valid values are: Rc40Bit, Rc128Bit, Aes128Bit loPDFCreatorJob.SetProfileSetting("PdfSettings.Security.OwnerPassword", m.pp_pdf_password) && Password that can be used to modify the document loPDFCreatorJob.SetProfileSetting("PdfSettings.Security.RequireUserPassword", "True") && If true, a password is required to open the document loPDFCreatorJob.SetProfileSetting("PdfSettings.Security.UserPassword", m.pp_pdf_password) && Password that must be used to open the document (if set)endif
loPDFCreatorJob.ConvertTo(m.directory + m.filename)
do while ! file(m.directory + m.filename) doevents wait window nowait "Attesa creazione file 3 ..."enddowait clear
do while ! loPDFCreatorJob.IsFinished doevents wait window nowait "Attesa rilascio file ..."enddowait clear
if ! loPDFCreatorJob.IsSuccessful messagebox("Errore nella creazione del file PDF!")endif
loPDFCreatorQueue.ReleaseCom()
RETURN*PROCEDURE STAMPA_PDF_173
*local loPDFCreator as PDFCreator.clsPDFCreator*loPDFCreator = CreateObject("PDFCreator.clsPDFCreator")
if ! loPDFCreator.cStart("/NoProcessingAtStartup") loPDFCreator.cStart("/NoProcessingAtStartup", 1)endif
if ! inlist(loPDFCreator.cError.Number, 0, 2) messagebox( ; "Errore " + ltrim(str(loPDFCreator.cError.Number)) + chr(13) + chr(13) + ; loPDFCreator.cError.Description, "Crea PDF con PDFCreator") RETURNendif
loPDFCreator.cPrinterStop = 0
loPDFCreator.cOption("AutosaveFormat") = 0loPDFCreator.cOption("UseAutosave") = 1loPDFCreator.cOption("UseAutosaveDirectory") = 1loPDFCreator.cOption("AutosaveDirectory") = m.directoryloPDFCreator.cOption("AutosaveFilename") = m.filenameloPDFCreator.cOption("StandardTitle") = juststem(m.filename)
if ! empty(m.pp_pdf_password) loPDFCreator.cOption("PDFOwnerPasswordString") = m.pp_pdf_password loPDFCreator.cOption("PDFOwnerPass") = 1 loPDFCreator.cOption("PDFUseSecurity") = 1endif
loPDFCreator.cOption("PDFDisallowCopy") = 0loPDFCreator.cClearcache()
local m.old_printerm.old_printer = set("PRINTER", 3)
set printer to name "PDFCreator"
report form (m.pp_report_filename) to printer noconsole
set printer to name (m.old_printer)
do while ! file(m.directory + m.filename) doevents wait window nowait "Attesa creazione file ..."enddowait clear
do while loPDFCreator.cCountOfPrintjobs > 0 doevents wait window nowait "Attesa rilascio file ... " + ltrim(str(loPDFCreator.cCountOfPrintjobs))enddowait clear
loPDFCreator.cClose()
RETURN*
Grazie Gianni, stavo impazzendo perché sul sito pdfforge non c’è nessuna documentazione relativa alla nuova versione… dove hai trovato?
Da: foxpro...@googlegroups.com [mailto:foxpro...@googlegroups.com] Per conto di Gianni Turri
Inviato: venerdì 30 ottobre 2015 16:55
A: Foxpro Italia
Oggetto: PDFCreator nuova versione 2.2.1, codice da correggere
--
Hai ricevuto questo messaggio perché sei iscritto al gruppo "Foxpro Italia" di Google Gruppi.
Per annullare l'iscrizione a questo gruppo e non ricevere più le sue email, invia un'email a foxpro-itali...@googlegroups.com.
Per postare in questo gruppo, invia un'email a foxpro...@googlegroups.com.
Per visualizzare questa discussione sul Web, visita https://groups.google.com/d/msgid/foxpro-italia/fd1c240e-85f0-407d-8fd4-6f25c4bcc669%40googlegroups.com.
Per altre opzioni visita https://groups.google.com/d/optout.
![]() |
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
|