VFP ·R¥ÎªÌªÀ°Ï ­º­¶ VFP ·R¥ÎªÌªÀ°Ï
¥»°Q½×°Ï¬° Visual Foxpro ·R¥ÎªÌ¸gÅç¥æ¬yªº¦a¤è, ½Ð¦h¦h§Q¥Î"·j´M"ªº¥\¯à, ¥ý¬d¬Ý¬Ý¦³µL«e¨Ò¥i´`, ¦pªGÁÙ¦³¤£À´ªº¦Aµo°Ý. ³¡¥÷¥DÃD¦³ªþ¥[ÀÉ®×, ¶·¥ýµù¥U¦¨¬°ªÀ°Ï©~¥Á¤~¥i¥H¤U¸ü.
 
 ±`¨£°ÝÃD±`¨£°ÝÃD   ·j´M·j´M   ·|­û¦Cªí·|­û¦Cªí   ·|­û¸s²Õ·|­û¸s²Õ   ·|­ûµù¥U·|­ûµù¥U 
 ­Ó¤H¸ê®Æ­Ó¤H¸ê®Æ   µn¤JÀˬd±zªº¨p¤H°T®§µn¤JÀˬd±zªº¨p¤H°T®§   µn¤Jµn¤J

NetPdfTools V1.01

 
µoªí·s¥DÃD   ¦^ÂÐ¥DÃD    VFP ·R¥ÎªÌªÀ°Ï ­º­¶ -> VFP °Q½×°Ï
¤W¤@½g¥DÃD :: ¤U¤@½g¥DÃD  
µoªí¤H ¤º®e
iswith



µù¥U®É¶¡: 2022-11-04
¤å³¹: 71


²Ä 1 ¼Ó

µoªíµoªí©ó: ¬P´Á¤­ ¤C¤ë 26, 2024 2:11 pm    ¤å³¹¥DÃD: NetPdfTools V1.01 ¤Þ¨¥¦^ÂÐ

NetPdfTools V1.01

iswith ¦b ¬P´Á¤é ¤C¤ë 28, 2024 9:21 pm §@¤F²Ä 3 ¦¸­×§ï
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
gxouyuan



µù¥U®É¶¡: 2022-05-25
¤å³¹: 12


²Ä 2 ¼Ó

µoªíµoªí©ó: ¬P´Á¤» ¤C¤ë 27, 2024 8:38 am    ¤å³¹¥DÃD: ¤Þ¨¥¦^ÂÐ

¤û
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
iswith



µù¥U®É¶¡: 2022-11-04
¤å³¹: 71


²Ä 3 ¼Ó

µoªíµoªí©ó: ¬P´Á¤G ¤C¤ë 30, 2024 3:44 pm    ¤å³¹¥DÃD: ¤Þ¨¥¦^ÂÐ

*--test_netpdftools DEMO Build 2024 07 29
Clear


public cPath
If Type( "_vfp.ActiveProject" ) == "O" Then
m.cPath = justPath( _vfp.ActiveProject.Name )
Else
m.cPath = Justpath( Sys(16) )
Endif

Set Default To ( m.cPath )
If !File( "netpdftools.vcx" ) And !File( "netpdftools.vct" ) Then
?"没§ä¨ì¡§netpdftools.vcx¡¨¥i视类库"
Endif

Set Classlib To netpdftools.vcx

Public oNetPdfTools
oNetPdfTools = Createobject( "NetPdfTools" )

*--ªì©l¤ÆPdfTools-----------------------------------------------------------------------------------------------------------
If !oNetPdfTools.PdfToolsInit() Then
?"ªì©l¤ÆPdfTools¥¢败"
Return .F.
Endif

Local lcPdfFileName ;
, lctoFilename ;
, lnFormat ;
, lcErrorMsg ;
, llReturn ;
, lnReturn ;
, loReturn ;
, lnHsTimes


*选择运¦æ区°ì时¥Î
Return

*1.------------------------------------------------------------------------------------------------------------------------
*将PDF2Linearized(线©Ê¤Æ)
*选择运¦æ区°ì时¥Î
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\_6YI01QSDM.PDF"
m.lctoFilename = Addbs( m.cPath ) + "testdata\_6YI01QSDM.PDF"
m.lcErrorMsg = ""
?"1.PDF2Linearized(线©Ê¤Æ)-> "
m.llReturn = oNetPdfTools.PDF2Linearized( m.lcPdfFileName , @lcErrorMsg , m.lctoFilename )
??Iif( m.llReturn , "转换¦¨¥\¨ì¡G" + m.lctoFilename , "转换¥¢败,­ì¦]¡G" + m.lcErrorMsg )


*2.------------------------------------------------------------------------------------------------------------------------
*将单个PDF¤å¥ó压缩
*CompressPdf( *pdffilename ¥²传 ³Q压缩ªºPDF¤å¥ó ¸ô径+¤å¥ó¦W.PDF
*toFilename ¥²传 压缩¥h¦V ¸ô径+¤å¥ó¦W.PDF
*ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
*nImageQuality «D¥²传 Àq认=1 图¤ù质¶q(0=High;1=Low;2=Medium)
*UnembedFonts «D¥²传 Àq认=false ¤£´O¤J¦rÊ^¡A¬Ý±¡úG¬Y¨ÇPDF¥Î¤F¯S®í¦rÊ^时设¸m =.F.;
)
*--ªð¦^­È¡GL
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif

Local lnImageQuality ;
, llUnembedFonts

m.lcErrorMsg = "" &&¤£传¦a§}变¶q参数时¡A¥X错会弹¥X¥X错对话®Ø¡C
m.lnImageQuality = 0 &&0=High;1=Low;2=Medium
m.llUnembedFonts = .T. &&¤£´O¤J¦rÊ^¡A¬Ý±¡úG¬Y¨ÇPDF¥Î¤F¯S®í¦rÊ^时设¸m为.F.
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\_6YI01QSDM.PDF"
m.lctoFilename = Addbs( m.cPath ) + "testdata\_6YI01QSDM_Compresstest.PDF"
?"2.PDF¤å¥ó压缩:CompressPdf-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.CompressPdf( m.lcPdfFileName ;
, m.lctoFilename ;
, @lcErrorMsg ;
, m.lnImageQuality;
, m.llUnembedFonts )
??Iif( m.llReturn , "转换¦¨¥\¨ì¡G" + m.lctoFilename , "转换¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)



*3.------------------------------------------------------------------------------------------------------------------------
*将¥Ø录¤Uªº¥þ³¡PDF¤å¥ó进¦æ压缩,¦}发¦h线µ{执¦æ,执¦æ¬Oªº进«×¥Ñ类¡§OnProgress¡¨¦Û动®·®»¥X现进«×显¥Ü
?"3.¥Ø录¤U¥þ³¡PDF¤å¥ó压缩:CompressPdfAllAsync"
*oNetPdfTools.CompressPdfAllAsync( Sys(2015 ) , "E:\NetPDFTools\testdata" )


*4.------------------------------------------------------------------------------------------------------------------------
*将PDF2Excel(Xlsx)
*PDF2Excel( * PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* ToFilename ¥²传 ¥h¦VXlsx¤å¥ó¡]¸ô径+¤å¥ó¦W.Xlsx)
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
* StartIndex «D¥²传 从²Ä¤L页开©l(暂¤£¤ä«ù¡^
* EndIndex «D¥²传 ¨ì²Ä¤L页结§ô(暂¤£¤ä«ù¡^;
)

*ªð¦^­È ¡GL

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\test5.PDF"
m.lctoFilename = Addbs( m.cPath ) + "testdata\test5.XLSX"
m.lcErrorMsg = ""
?"4.PDF2Excel(Xlsx)-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.PDF2Excel( m.lcPdfFileName , m.lctoFilename , @lcErrorMsg )
??Iif( m.llReturn , "转换¦¨¥\¨ì¡G" + m.lctoFilename , "转换¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)

*5.------------------------------------------------------------------------------------------------------------------------
*将PDF2Word(Docx)
*PDF2Word ( * PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* ToFilename ¥²传 ¥h¦VXlsx¤å¥ó¡]¸ô径+¤å¥ó¦W.Docx)
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
* StartIndex «D¥²传 从²Ä¤L页开©l(暂¤£¤ä«ù¡^
* EndIndex «D¥²传 ¨ì²Ä¤L页结§ô(暂¤£¤ä«ù¡^;
)
*ªð¦^­È ¡GL

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\test1.PDF"
m.lctoFilename = Addbs( m.cPath ) + "testdata\test1.Docx"
m.lcErrorMsg = ""
?"5.PDF2Word(Docx)-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.Pdf2Word( m.lcPdfFileName , m.lctoFilename , @lcErrorMsg )
??Iif( m.llReturn , "转换¦¨¥\¨ì¡G" + m.lctoFilename , "转换¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*6.------------------------------------------------------------------------------------------------------------------------
*将PDF转换¦¨»Ý­nªº®æ¦¡¤å¥ó
*PDF2Image( * pdffilename As String ¥²传参
* toFilename As String «D传参 ­È=ªÅ -> §YÉOPDF¦P¦W¥B¦P¥Ø录(页数).扩®i¦W¥Ñformatsú¨©w;
­È=¥u¬O¸ô径 -> ¨ú¸ô径+³Q转换ªºPDF¤å¥ó¦W(页数).扩®i¦W¥Ñformatsú¨©w;
­È=¸ô径+¤å¥ó¦W.扩®i¦W -> ¥u¨ú ¸ô径 + ¤å¥ó¦W (图¤ù§Ç数).扩®i¦W¥Ñformatsú¨©w;

* ErrorMsg As String «D¥²传 ¤£传´N会¦b¥X错时,弹¥X错误对话®Ø,传ªº话´N¦a§}ªð­È
* StartIndex As Integer «D¥²传 StartIndex ÉO EndIndex ¤£传´N¨ú¥þ³¡页,Àq认­È=1(²Ä¤@页)
* EndIndex As Integer «D¥²传 结§ô页¡AÀq认=-1¨ú¥þ³¡
* Format As Integer «D¥²传 Àq认=3
*Bmp = 1
*Jpeg = 2
*Png = 3
*Gif = 4
*Tiff = 5
*Wmf = 6
*Emf = 7
* dpi As Integer «D¥²传 Àq认=300 dpi ,­È¶V¤j转换¦Zªº图¤ù®e¶q´N¶V¤j,¶V¤p图¤ù质¶q´N¶V®t;
)
*ªð¦^­È ¡GL


*选择运¦æ区°ì时¥Î
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\test.PDF"
m.lnFormat = 2
*!* m.lctoFilename = ""
m.lctoFilename = Addbs( m.cPath ) + "testdata\PDF2Image\"
*!* m.lctoFilename = Addbs( m.cPath ) + "testdata\PDF2Image\123.jpg"
m.lcErrorMsg = ""
m.lnStartIndex = 1
m.lnEndIndex = 10
m.lndpi = 300
?"6.将PDF2Image->"
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.PDF2Image( m.lcPdfFileName , m.lctoFilename , @lcErrorMsg , m.lnStartIndex , m.lnEndIndex , m.lnFormat , m.lndpi )
?Iif( !m.llReturn , "转换¥¢败,­ì¦]¡G" + m.lcErrorMsg , "" )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*7.------------------------------------------------------------------------------------------------------------------------
*¦h个PDF¤å档¦X¦}
*MergePdfFiles(
*SourceFiles As String ¥²传 [a.pdf,b.pdf]
*OutputFile As String ¥²传 ¦X¦¨¦ZªºPDF¤å¥ó¡G ¸ô径+¤å¥ó¦W.扩®i¦W
*ErrorMsg As String «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø;
)
*ªð¦^­È ¡GL

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
Local lcSourceFiles ;
, lcOutputFile

m.lcSourceFiles = Addbs( m.cPath ) + "testdata\_6YA1E3JCX.PDF"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\_6YB0HU3SA.PDF"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\_6YB1DI8LC.PDF"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\_6YB1DX1V4.PDF"

m.lcOutputFile = Addbs( m.cPath ) + "testdata\MergePdf.PDF"
m.lcErrorMsg = ""
?"7.¦h个PDF¤å档¦X¦}-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.MergePdfFiles( m.lcSourceFiles, m.lcOutputFile, @lcErrorMsg )
?Iif( m.llReturn , "¦X¦}¦¨¥\¨ì¡G" + m.lcOutputFile, "¦X¦}¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*8.------------------------------------------------------------------------------------------------------------------------
*¦h个Excel¤å档¦X¦}(¤£»Ý­n¦w装office®M¥ó)
*MergeExcelFiles(
*SourceFiles ¥²传 [a.xls,b.xls]|[a.xlsx,b.xlsx]
*OutputFile ¥²传 ¦X¦¨¦ZªºExcel¤å¥ó¡G ¸ô径+¤å¥ó¦W.扩®i¦W
*ErrorMsg «D¥²传 ¤£传´N会¦b¥X错时弹¥X错误对话®Ø
*isDeleteFile «D¥²传 ¬O§_删°£a.xls,b.xls...这类¤å¥ó Àq认­È=false
*isQname «D¥²传 ¬O§_üL¦W Àq认­È=false;=true 则¨t统üL¦W为Page1.....n;
)
*ªð¦^­È ¡GL

*ª`·N¡G¦pªG¤u§@区¦W称为¡§Sheet¡¨©ÎisQname = true 时SheetName§ï变为"Page1...N",§_则¨ú¤§«eªº¤u§@区¦W称;
¦ý­nª`·N¤u§@区¦P¦W¡A则¥¢败¡A¤@个¤å档¤£¥i¥H¦P¦W¤u§@区¦W称

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif

Local lisDeleteFile ;
, lisQname

m.lcSourceFiles = Addbs( m.cPath ) + "testdata\KPI1.xlsx"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\KPI2.xlsx"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\KPI3.xlsx"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\KPI4.xlsx"
m.lcOutputFile = Addbs( m.cPath ) + "testdata\MergeExcel_KPI.xlsx"
m.lcErrorMsg = ""
m.lisDeleteFile = .F.
m.lisQname = .T.
?"8.¦h个Excel¤å档¦X¦}-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.MergeExcelFiles( m.lcSourceFiles, m.lcOutputFile , @lcErrorMsg , m.lisDeleteFile , m.lisQname )
?Iif( m.llReturn , "¦X¦}¦¨¥\¨ì¡G" + m.lcOutputFile , "¦X¦}¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*9.------------------------------------------------------------------------------------------------------------------------
*¦h个Word¤å档¦X¦}(¤£»Ý­n¦w装office®M¥ó)
*MergeWordFiles(
*SourceFiles ¥²传 a.docx,b.docx
*OutputFile ¥²传 ¦X¦¨¦ZªºExcel¤å¥ó¡G ¸ô径+¤å¥ó¦W.扩®i¦W
*ErrorMsg «D¥²传 ¤£传´N会¦b¥X错时弹¥X错误对话®Ø
*isDeleteFile «D¥²传 ¬O§_删°£a.xls,b.xls...这类¤å¥ó Àq认­È=false
)
*ªð¦^­È ¡GL

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcSourceFiles = Addbs( m.cPath ) + "testdata\KPI1.docx"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\KPI2.docx"
m.lcSourceFiles = m.lcSourceFiles+ [,] + Addbs( m.cPath ) + "testdata\KPI3.docx"
m.lcOutputFile = Addbs( m.cPath ) + "testdata\MergeWord_KPI.docx"
m.lcErrorMsg = ""
m.lisDeleteFile = .F.
?"9.¦h个Word¤å档¦X¦}-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.MergeWordFiles( m.lcSourceFiles, m.lcOutputFile , @lcErrorMsg , m.lisDeleteFile )
?Iif( m.llReturn , "¦X¦}¦¨¥\¨ì¡G" + m.lcOutputFile, "¦X¦}¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*10.------------------------------------------------------------------------------------------------------------------------
*´£¨úPDFªºªí®æ数Õu¨ìVFP(类¡§onprogress¡¨¨Æ¥ó®·®»¡A¤@个ªí®æ¤@个cJson,ª`·N¥i¯à¦³¦h个cJson)

*ExtractPdfTable( * PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* toFilename «D传参 ¦pªG转¥X图¤ùªº¥Ø录为ªÅ -> §YÉOPDF¦P¦W¥B¦P¥Ø录(页数).扩®i¦W¥Ñformatsú¨©w;
¦pªG传过来ªº¥u¬O¸ô径 -> ¨ú¸ô径+³Q转换ªºPDF¤å¥ó¦W(页数).扩®i¦W¥Ñformatsú¨©w;
¦pªG§t¦³ ¸ô径+¤å¥ó¦W.扩®i¦W -> ¥u¨ú ¸ô径 + ¤å¥ó¦W (页数).扩®i¦W¥Ñformatsú¨©w
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
* Format «D¥²传 图¤ù®æ¦¡ Àq认­È:=3
* StartIndex «D¥²传 从²Ä¤L页开©l Àq认­È:=1 ²Ä¤@页
* EndIndex «D¥²传 ¨ì²Ä¤L页结§ô Àq认­È:=-1 ¥þ³¡页;
)
*ªð¦^­È ¡GL
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcSourceFiles = Addbs( m.cPath ) + "testdata\test6.pdf"
m.lcErrorMsg = ""
?"10.´£¨úPDFªºªí®æ数Õu¨ìVFP-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.ExtractPdfTable( m.lcSourceFiles, @lcErrorMsg )
?Iif( m.llReturn , "¦¨¥\¥Í¦¨ªí¡§ExtractPdfTable¡¨,请¦Û¦æ¸ÑªRcJson" , "´£¨úPDFªí®æ¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*11.------------------------------------------------------------------------------------------------------------------------
*´£¨úWordªºªí®æ数Õu¨ìVFP(¤£»Ý­n¦w装office®M¥ó)(类¡§onprogress¡¨¨Æ¥ó®·®»¡A¤@个ªí®æ¤@个cJson,ª`·N¥i¯à¦³¦h个cJson)
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcSourceFiles = Addbs( m.cPath ) + "testdata\KPI.docx"
m.lcErrorMsg = ""
?"11.´£¨úWordªºªí®æ数Õu¨ìVFP-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.ExtractWordTable( m.lcSourceFiles, @lcErrorMsg )
?Iif( m.llReturn , "¦¨¥\¥Í¦¨ªí¡§ExtractWordTable¡¨,请¦Û¦æ¸ÑªRcJson" , "´£¨úWordªí®æ¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*12.------------------------------------------------------------------------------------------------------------------------
*´£¨úExcelªºªí®æ数Õu¨ìVFP(¤£»Ý­n¦w装office®M¥ó)(类¡§onprogress¡¨¨Æ¥ó®·®»¡A¤@个ªí®æ¤@个cJson,ª`·N¥i¯à¦³¦h个cJson)
*ExtractExcelTable( * cSourceFiles ¥²传 ´£¨úªºExcel¤å¥ó¡]¸ô径+¤å¥ó¦W.Xlsx)
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
* StartIndex «D¥²传 从²Ä¤L页开©l,Àq认=1,§Y²Ä¤@个¤u§@区
* EndIndex «D¥²传 ¨ì²Ä¤L页结§ô,Àq认=-1¡A§Y¥þ³¡¤u§@区;
)
*ªð¦^­È ¡GL

If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcSourceFiles = Addbs( m.cPath ) + "testdata\KPI1.xlsx"
m.lcErrorMsg = ""
?"12.´£¨úExcelªºªí®æ数Õu¨ìVFP-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.ExtractExcelTable( m.lcSourceFiles, @lcErrorMsg )
?Iif( m.llReturn , "¦¨¥\¥Í¦¨ªí¡§ExtractExcelTable¡¨,请¦Û¦æ¸ÑªRcJson" , "´£¨úExcelªí®æ¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)


*13.------------------------------------------------------------------------------------------------------------------------
*´£¨úPDF图¤ù,«ö¤°¤\图¤ù®æ¦¡导¥X¦Ü¤°¤\¸ô径¤U
*ExtractPdfImage(
* PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* toFilename «D传参 ­È=ªÅ -> §YÉOPDF¦P¦W¥B¦P¥Ø录(页数).扩®i¦W¥Ñformatsú¨©w;
­È=¥u¬O¸ô径 -> ¨ú¸ô径+³Q转换ªºPDF¤å¥ó¦W(页数).扩®i¦W¥Ñformatsú¨©w;
­È=¸ô径+¤å¥ó¦W.扩®i¦W -> ¥u¨ú ¸ô径 + ¤å¥ó¦W (图¤ù§Ç数).扩®i¦W¥Ñformatsú¨©w;
(§Y时扩®i¦W¤£会©wúå¦ý¤]­n写¤J¨t统,»Ý­n§P©w¥Ø录ÉO¤å¥ó¦W区别)
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø
* ImageFormat «D¥²传 图¤ù®æ¦¡ Àq认­È:=2
*Bmp = 1
*Jpeg = 2
*Png = 3
*Gif = 4
*Tiff = 5
*Wmf = 6
*Emf = 7
* StartIndex «D¥²传 从²Ä¤L页开©l Àq认­È:=1 ²Ä¤@页
* EndIndex «D¥²传 ¨ì²Ä¤L页结§ô Àq认­È:=-1 ¥þ³¡页;
)
*ªð¦^­È ¡GL
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif

m.lcPdfFileName = Addbs( m.cPath ) + "testdata\_6YI01QSDM.PDF"
m.lnFormat = 2

*--ÉO­ìPDF¦P级¥Ø录¦P¤å¥ó¦W.扩®i¦W(¥ÑFormatú¨©w),©Î¤£传
*!* m.lctoFilename = ""

*--¥h¦V¥Ø录¥B­«·s©R¦W
*!* m.lctoFilename = Addbs( m.cPath ) + "testdata\ExtractPdfImage\123.jpg"

*--¥h¦V¥Ø录,ª`·N带¡§\¡¨
m.lctoFilename = Addbs( m.cPath ) + "testdata\ExtractPdfImage\"
m.lcErrorMsg = ""
m.lnStartIndex = 1
m.lnEndIndex = -1

?"13.´£¨úPDF图¤ù,«ö¤°¤\图¤ù®æ¦¡导¥X¦Ü¤°¤\¸ô径¤U-> "
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.ExtractPdfImage( m.lcPdfFileName, m.lctoFilename, @lcErrorMsg , m.lnFormat , m.lnStartIndex , m.lnEndIndex )
?Iif( m.llReturn , "" , "´£图¤ù¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)



*14.------------------------------------------------------------------------------------------------------------------------
*¬d§äword¬q¸¨/ªí®æ¤¤ªº¤å¦r(¤£»Ý­n¦w装office®M¥ó)¦}将¨ä´À换,©Ê¯à¤ñ传统ªº¯Ó时为¡G1/20,¬Æ¦Ü§ó§Ö
*WordReplaceText(
* WordFiles ¥²传 Word¤å¥ó ¡]¸ô径+¤å¥ó¦W.Docx)
* Findtext ¥²传 ¬d§äªº¦r²Å
* Replacetext ¥²传 ´À换ªº¦r²Å
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø;
)
*ªð¦^­È ¡GL
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
Local lcWordFiles;
, lcFindtext ;
, lcReplacetext

m.lcWordFiles = Addbs( m.cPath ) + "testdata\KPI.docx"
m.lcFindtext = "测试"
m.lcReplacetext = "NetTools"
m.lcErrorMsg = ""
?"14.Word¤å¦r´À换:WordReplaceText->"
m.lnHsTimes = Seconds()
m.llReturn = oNetPdfTools.ReplaceWordText( m.lcWordFiles , m.lcFindtext , m.lcReplacetext , @lcErrorMsg)
??Iif( m.llReturn , "¦¨¥\" , "¥¢败,­ì¦]¡G" + m.lcErrorMsg )
??"->¯Ó时¡G" + Transform( Seconds() - m.lnHsTimes)

*15.------------------------------------------------------------------------------------------------
*获¨úPDF¦³¦h¤Ö页
*GetPdfPage(
* PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø;
)
*ªð¦^­È ¡GN
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\_6YI01QSDM.PDF"
m.lcErrorMsg = ""
?"15.ªð¦^PDF页数-> "
m.lnReturn = oNetPdfTools.GetPdfPage( m.lcPdfFileName, @lcErrorMsg )
??Iif( Empty( lcErrorMsg ) , m.lnReturn , "ªð¦^PDF页数¥¢败,­ì¦]¡G" + m.lcErrorMsg )


*16.----------------------------------------------------------------------------------------------
*获¨úPDF¬Y页¤å¥»
*GetPdfText(
* PdfFileName ¥²传 来·½PDF¤å¥ó¡]¸ô径+¤å¥ó¦W.Pdf)
* nPage ¥²传 ¬Y页
* ErrorMsg «D¥²传 ¤£传´N会¦b¥X时弹¥X错误对话®Ø;
)
*ªð¦^­È:C
If "temp" $ Lower( Sys(16) ) Then
Clear
Endif
m.lcPdfFileName = Addbs( m.cPath ) + "testdata\_6YB0H7JV0.PDF"
m.lcErrorMsg = ""
m.lnPage = 1
?"16.ªð¦^PDF¬Y页¤å¥»-> "
m.lcReturn = oNetPdfTools.GetPdfText( m.lcPdfFileName, m.lnPage , @lcErrorMsg )
??Iif( Empty( m.lcErrorMsg ) , Left( m.lcReturn , 10 ) + "....." , "ªð¦^PDF¬Y页¤å¥»,­ì¦]¡G" + m.lcErrorMsg )
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
iswith



µù¥U®É¶¡: 2022-11-04
¤å³¹: 71


²Ä 4 ¼Ó

µoªíµoªí©ó: ¬P´Á¤T ¤C¤ë 31, 2024 3:44 pm    ¤å³¹¥DÃD: 18个¥\¯à°µ发¦æ²Ä¤@ª© ¤Þ¨¥¦^ÂÐ

18个¥\¯à°µ发¦æ²Ä¤@ª©
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
iswith



µù¥U®É¶¡: 2022-11-04
¤å³¹: 71


²Ä 5 ¼Ó

µoªíµoªí©ó: ¬P´Á¥| ¤K¤ë 01, 2024 7:38 pm    ¤å³¹¥DÃD: ¤Þ¨¥¦^ÂÐ

¥þ¥]资·½请¦bcsdn¤U载
https://download.csdn.net/download/weixin_53925881/89606078
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
GOLDHAN



µù¥U®É¶¡: 2004-06-07
¤å³¹: 9


²Ä 6 ¼Ó

µoªíµoªí©ó: ¬P´Á¤­ ¤K¤ë 30, 2024 11:34 pm    ¤å³¹¥DÃD: ¤Þ¨¥¦^ÂÐ

¤Ó¤û¤F~¦ýCSDN³sµ²¦ü¥GµLªk¤U¸ü
¦^³»ºÝ
À˵ø·|­û­Ó¤H¸ê®Æ µo°e¨p¤H°T®§
±q¤§«eªº¤å³¹¶}©lÅã¥Ü:   
µoªí·s¥DÃD   ¦^ÂÐ¥DÃD    VFP ·R¥ÎªÌªÀ°Ï ­º­¶ -> VFP °Q½×°Ï ©Ò¦³ªº®É¶¡§¡¬° ¥x¥_®É¶¡ (GMT + 8 ¤p®É)
²Ä1­¶(¦@1­¶)

 
«e©¹:  
±z µLªk ¦b³o­Óª©­±µoªí¤å³¹
±z µLªk ¦b³o­Óª©­±¦^ÂФ峹
±z µLªk ¦b³o­Óª©­±½s¿è¤å³¹
±z µLªk ¦b³o­Óª©­±§R°£¤å³¹
±z µLªk ¦b³o­Óª©­±¶i¦æ§ë²¼
±z µLªk ¦b³o­Óª©­±ªþ¥[ÀÉ®×
±z µLªk ¦b³o­Óª©­±¤U¸üÀÉ®×


Powered by phpBB © 2001, 2005 phpBB Group
¥¿Å餤¤å»y¨t¥Ñ phpbb-tw ºûÅ@»s§@