当前位置:网站首页>Processing PDF and JPG files in VB6
Processing PDF and JPG files in VB6
2022-07-24 23:29:00 【Who was that yesterday】
A recent project needs pdf The file page is output as jpg Picture file , And then for these outputs jpg Page clipping .
because VB6 It's old , Many mainstream plug-ins do not vb6 Usable api Or sample code , I've been looking for it on the Internet for a long time , To sum up VB6 Feasible plan :
One 、 Handle pdf file
1.Apache PDFBox
PDFBox It's a use Java Open source PDF Document processing library
Download here :
http://pdfbox.apache.org/
Because it's using Java Compiling , So you need to install... Before use jre
The program supports command line , stay VB The specific calling method in is shell() Command invocation , for example :
shell ("java -jar pdfbox-app-2.0.4.jar PDFToImage -imageType jpg C:\1.pdf") The above command will be a pdf All pages of the file are output as jpg picture , There are many other commands that can be used , Specific reference :
http://pdfbox.apache.org/2.0/commandline.html
PDFBox One big disadvantage is that the processing speed is slow
2.Debenu Quick PDF Library
Debenu At present, it has been used by domestic Foxit Fuxi acquired , It's a commercial software , You need to pay for it , But you can find the registration code online .
Required after download ActiveX Of quickpdf.dll and quickpdf.tlb Two documents , You can use the system's own Regsvr32 register quickpdf.dll, Or not , If there is an error running on other computers, you need to register .
menu bar - engineering - quote , Select browse , Choose quickpdf.tlb Later, this library was referenced in the project : 
Next , Can press F2 Check the objects that can be called in this library , The complete development documentation is here :
http://www.debenu.com/products/development/debenu-pdf-library/help/developer-guide/
The next step is to enter the actual development process , Because it's commercial software , First, you need to enter the registration information :
Dim pb As New DebenuPDFLibraryAX1016.PDFLibrary
Dim RegStatus As Integer
RegStatus = pb.UnlockKey("j87ig3k84fb9eq9dy34z7u66y")
Print RegStatusIf it returns RegStatus by 1, It indicates that the registration is successful
take PDF The page is converted into a picture file :
QP.LoadFromFile("sample.pdf", "") ' The first step is to load the file into memory
iNumPages = QP.PageCount() ' obtain pdf Number of pages of the file
QP.RenderDocumentToFile(100, 1, iNumPages, 0, "image.bmp") ' transformation For other commands, please refer to the development documentation
Two 、 Handle jpg image file
There are two solutions offered online : Use GDI+; call Intel JPEG lib. Here is another open source solution FreeImage, Support jpg、png、bmp And other image processing , Download here dll And development documentation :
http://freeimage.sourceforge.net/download.html
The required files are in the compressed package FreeImage.dll and modFreeImage.bas, Put the two files in the program directory .
Build a new project , take modFreeImage.bas Add as a module , So you can call dll 了 .
Resample the image :
Dim dib As Long
Dim dib2 As Long
dib = FreeImage_LoadU(FIF_JPEG, "jpgfile.jpg",0) ' Load pictures into memory
dib2 = FreeImage_Rescale(dib, 1280, 800, FILTER_BOX) ' Resampling
Call FreeImage_SaveU(FIF_JPEG, dib2, "tgfile.jpg",0) ' Save the file
FreeImage_Unload(dib) ' Free memory 边栏推荐
- Piziheng embedded: the method of making source code into lib Library under MCU Xpress IDE and its difference with IAR and MDK
- Js----- Chapter 4 array
- ASP. Net core 6.0 data validation based on model validation
- 用VS Code搞Qt6:编译源代码与基本配置
- Routing policy in republishing
- 给生活加点惊喜,做创意生活的原型设计师丨编程挑战赛 x 选手分享
- About constant modifier const
- P3201 [HNOI2009] 梦幻布丁 启发式合并
- The specified data is grouped and the number of repetitions is obtained in Oracle
- Code coverage
猜你喜欢

Value driven provides the core driving force for the transformation of commercial BP - BP realization under business scenarios - Commercial BP sharing

JS ------ Chapter 3 JS cycle

Zheng Huijuan: Research on application scenarios and evaluation methods of data assets based on the unified market

Some analysis of slow MySQL query

The specified data is grouped and the number of repetitions is obtained in Oracle

Notes of Teacher Li Hongyi's 2020 in-depth learning series lecture 1

Piziheng embedded: the method of making source code into lib Library under MCU Xpress IDE and its difference with IAR and MDK

Notes of Teacher Li Hongyi's 2020 in-depth learning series 5

认识复杂度和简单排序运算

JUC concurrent programming - Advanced 05 - lock free of shared model (CAS | atomic integer | atomic reference | atomic array | field updater | atomic accumulator | unsafe class)
随机推荐
Notes of Teacher Li Hongyi's 2020 in-depth learning series 8
Talk about how redis handles requests
Network Security Learning (V) DHCP
The tragic experience of installing scikitlearn on win764
Three ways of shell debugging and debugging
On the problem that the on-board relay cannot be switched on due to insufficient power supply
芯片的功耗
Okaleido tiger NFT is about to log in to binance NFT platform, and the future market continues to be optimistic
Network Security Learning (I) virtual machine
Analysis of WPF multi finger application development
MATLAB basic grammar (II)
Do you need to open an account to buy a wealth management product with a 6% income?
Collection of common online testing tools
用VS Code搞Qt6:编译源代码与基本配置
Browser cache
The size of STM32 stack
背景图和二维码合成
Pointrender parsing
Cross entropy loss
Lidar obstacle detection and tracking: CUDA European clustering