Extracting page dimensions from a PDF with a C++ program [duplicate] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?
I looked at the answers to this question, but they mostly relate to .Net.

LibHaru
Haru is a free, cross platform,
open-sourced software library for
generating PDF written in ANSI-C. It
can work as both a static-library (.a,
.lib) and a shared-library (.so,
.dll).
Didn't try it myself, but maybe it can help you

I worked on a project that required a pdf report. After searching for online I found the PoDoFo library. Seemed very robust. I did not need all the features, so I created a wrapper to abstract away some of the complexity. Wasn't too difficult. You can find the library here:
http://podofo.sourceforge.net/
Enjoy!

If you're brave and willing to roll your own, you could start with a PostScript library and augment it to deal with PDF, taking advantage of Adobe's free online PDF reference.

jagpdf seems to be one of them. It is written in C++ but provides a C API.

It depends a bit on your needs. Some toolkits are better at drawing, others are better for writing text. Cairo has a pretty good for drawing (it support a wide range of screen and file types, including pdf), but it may not be ideal for good typography.

PDF Hummus.
see for http://pdfhummus.com/ - contains all required features for manipulation with PDF files except rendering.

LibHaru seems to be used by many.
A non-open source approach is: PDF Creator Pilot which provides more language options including C++, C#, Delphi, ASP, ASP.NET, VB, VB.NET, VBScript, PHP and Python

muPdf library looks very promising: http://mupdf.com/
There is also an open source viewer: http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html

Try wkhtmltopdf
Software features
Cross platform.
Open source.
Convert any web pages into PDF documents using webkit.
You can add headers and footers.
TOC generation.
Batch mode conversions.
Can run on Linux server with an XServer (the X11 client libs must be installed).
Can be directly used by PHP or Python via bindings to libwkhtmltox.

http://wxcode.sourceforge.net/docs/wxpdfdoc/
Works with the wxWidgets library.

Related

Best Technology for a medical 3D Planning Software [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking to build a new Interactive 3D planning software similar to this one http://www.materialise.com/materialise/view/en/131410-SimPlant.html
I was looking for some expert advise about the best technologies to use to build the different components of the software (ie: UI, Image processing, visualization, 3D, etc.. )
The software need to be able to process the images very quickly and in the same time I need to be able to deliver the software to the market fast, so the technologies used should allow for both rapid application development, and high performance. Any advise would be appreciated
Take a look at VTK (vtk.org) for an general purpose visualization toolkit and the ITK (itk.org)
which is an image analysis toolkit built on top of vtk. Both are BSD licensed.
The Python Imaging Library, PIL, is a good compromise between speed-to-market and good performance (and you can always use scipy and its core part, numpy, to enrich it for more advanced image-processing needs, if you pick Python as your pivot language!-). Similarly, visualization (including 3D) are excellently covered in third-party Python extensions -- check out EPD, the Enthought Python Distribution, for a good idea of what libraries might best help you in such tasks (you can always build your own versions if you don't want to partner with Enthought for commercial distribution... but it might be worth checking them out, as they have excellent commercial contacts as well as tech skills;-).
When and if you want to dip down into C++ for some specific component, Boost.Python, SIP, or Cython will make it child's play to integrate the component into your Python mainstream. For UI &c, PyQt is great...
In other words, while I'm obviously biased, in your shoes I'd unhesitatingly go for Python as the "core" and investigate the various options I've mentioned for visualization, UI, etc, etc. One caveat: for quick time-to-market, stick with Python 2.6: the newest 3.1, while great in many respects, is likely to still miss compatible versions of many third party extensions that will make your life way easier and sweeter with Python 2.6!
ITK is not built on top of VTK, although they are related. One can easily process data with ITK and then switch to a VTK pipeline for the visualization and interaction functionality.
We have built fairly large and complex medical image processing and visualization applications (experimental, surgical planning) in Python using a combination of VTK, ITK and wxPython. The licensing of all these components is such that you can use them in commercial applications.

how to write a text editor in c++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I learned c++ on and off for several times but never write a real apps using it .
long time I've been thinking that writing a text editor will be something very interesting , now I am looking for a simple but decent text editor written in c or c++ from which I can get inspiration and learn how to write a text editor by myself.
Could you guys recommend a "simple but decent" text editor written in c or c++ to me ?
You might want to look at Zile or nvi. Both are fairly simple; Zile is Emacs-like, and nvi is the Berkeley vi. Another to look at would be Nano, a simple text editor that is designed to be easy for new users. I don't know how clean the code is on any of these, though.
I would also recommend reading The Craft of Text Editing: Emacs for the Modern World. This book surveys many of the specific problems that have to be dealt with in writing a text editor along with approaches, strategies, and algorithms for solving them. Its content should be relevant and useful even if your editor isn't going to look much like Emacs at all.
Well what you want to see sounds more like a tutorial than an actual application (I think applications like Notepad++ will be a lot to dive into in the beginning). Since you don't mention any environment you want to program in, you could check out the QT Text Editor Demo. QT is a cross platform GUI Toolkit so you are not bound to a specific operating system but probably harder to setup then a Visual Studio environment in Windows.
For Windows only you might want to think about digging more into the .NET platform (e.g. C#) as suggested in this question. It doesn't help learning C++ but it makes GUI development a hell of a lot easier.
Get the vi.
There is a big lack of true editors like vi/vim ;)
I mean there is a plenty of editors like notepad/notepad++,
but few editors which have separate command/control mode.
So You could look at the vi sources to inspire yourself and introduce something revolutionary.
Notepad++ is an excellent open source editor written in C++.
Notepad++ for some definitions of "simple".
You may also check out Scintilla editing component.
JuffEd. It is written in C++, cross platform due to usage of Qt and QScintilla. Notepad++ uses also Scintilla text editor component, but its limited only to Windows platform.
What sort of text editor would you like to make?
First question is will this be GUI or Console based?
GUI based, do you want to make something like Notepad? And on what platform? If it's MS Windows based, might I recommend picking up on MFC?
If it's text based, there are many open source solutions you can get into. My recommendation is to look at the simplest of editors like ed or something.
loot to the QT this is cross platform,HAVE RICHTEXT COMPONENT(widget).Writing first app in QT will give you actual knowledge.I recommend to learn QT by book

C++ Library to Convert HTML to PDF? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am looking for a C/C++ library to convert HTML (Actually XHTML + CSS) documents to PDF.
It is for commercial use and source would be nice but not essential.
Anybody have any recommendations or experience doing this?
UPDATE: To clarify, I am targeting the Windows platform only. I am developing with Borland C++ Builder 2006, but the library does not have to be a VCL component.
Many thanks in advance.
Steve.
To do that I have successfully used wkhtmltopdf.
Uses webkit and can be called from command line or as a static library. It's great and simply to use.
wkhtmltopdf website
OpensSource (LGPL) and free!
Hope it can help
Wouuld CLI applications do? If memory fails me not, GNU Ghostscript had utilities html2ps and ps2pdf. Source should be available too.
This is probably overkill, but WebKit for rendering, with Cairo for the backend could do it. WebKit is a pretty big library, though.
If you are looking for something pre-made, I found wkhtmltopdf after some quick searching. It uses WebKit and Qt for rendering, which is and even larger combination of libraries.
Just to bump this, I have evaluated both VisPDF and PDFDoc Scout and will probably go with PDFDoc Scout as it can format HTML input.
Thanks for everybody else's input.
I tried HotPDF library, it is easy to use and good enough.
CutePDF is a free PDF writer that works as a virtual printer. I guess you could use this in conjunction with anything that could render your HTML.
Have a look at PrinceXML.
It's definately the best HTML/CSS to PDF converter out there, although it's not free (But hey, your programming is not free either, so if it saves you 10 hours of work, you're home free.)
Oh yeah, did i mention that this is the first (and probably only) HTML2PDF solution that does full ACID2!?!?!
http://princexml.com/samples/

Scatter Plots in C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
What is the best way to graph scatter plots in C++?
Do you write data to a file and use another tool? Is there a library like matplotlib in Python?
I always write out data and then using gnuplot to create my graphs. It is by far the best way I have found of producing graphs in a variety of formats: eps, png, jpeg, xpm, you name it.
gnuplot will do scatter plot very easily. Provided the x and y values are in 2 space-separated columnss, then
plot "data.txt" using 1:2
Will give you a quick scatter plot. Then you can adjust it and what not using other gnuplot commands.
If you are involved in sciences, then learning gnuplot will be very valuable to you. It kicks the crap out of doing excel plots for sure and it eases the task of making plots to include in papers.
If you are looking for a C++ library rather than I independent plotting tool like gnuplot, I would consider the following:
Koolplot
dislin (Wikipedia article on dislin)
dislin seems to be the more interesting of the two. Here is a description extracted from the wikipedia article:
DISLIN is a high-level and easy to use plotting library developed by Helmut Michels at the Max Planck Institute in Katlenburg-Lindau, Germany. Helmut Michels currently works as a mathematician and Unix system manager at the computer center of the institute.
The DISLIN library contains routines and functions for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such as X11, VGA, PostScript, PDF, CGM, HPGL, SVG, PNG, BMP, PPM, GIF and TIFF.
DISLIN is available for the programming languages Fortran 77, Fortran 90/95 and C. Plotting extensions for the languages Perl, Python and Java are also supported for most operating systems. The current version of DISLIN is 9.4, released in October 2008. The first version 1.0 was released in December 1986.
The DISLIN software is free for non-commercial use.
Very heavy solution: you could link against ROOT, which will do just about anything you want:
runs on Mac, Windows and Linux
runs compiled or using the cint interperter
output to a file in encapsulated postscript, PDF, gif, png...
display to the screen using several different technologies
serialize the data in an internal format that can be manipulated later
Sure, its a bit much for most people, but it does do exactly what you asked for. I use it because I know it and it is already on my machines becase I'm that kind of physicist.
Good old GNU, they have everything...
http://directory.fsf.org/project/plotutils/
This is certainly not the best way but I usually write output files that can be read by R and use this, along with an appropriate script, to plot the graphs.
The problem here is that C++, unlike Java for example, does not have built-in GUI or graphics. If you want to generate graphs with C++ you would need to use a GUI library available for your OS. There are free GUI libraries, many cross-plaform such as Qt or GTK.
However, as other people have pointed out, the easiest thing for you to do would be to save the data into a text file, and use another program to generate the graph. gnuplot is definitely a good choice. It comes standard with most linux distros, and you get for Windows under cygwin.
Regards plotting in C++ for anyone who didn't do it yet. I will say what I did to plot Graphs in C++
Download the zipped file "gp443win32.zip" from http://sourceforge.jp/projects/sfnet_gnuplot/downloads/gnuplot/4.4.3/gp443win32.zip/
Extract it in "C:\Gnuplot"
then I read "C:\Gnuplot\gnuplot\README.Windows"
and I got these information:
I used Windows 7 ==> so you need to download "winhlp32.exe"... just search for it "winhlp32.exe Windows 7" in a search engine and go through the first link.
Append to the "Path" Environment variable the path for binary folder which is "C:\Gnuplot\gnuplot\binary"
then I shutdown my computer and open it again. After I found that it didn't sense the change in the environment variables :D
you need now to write a sample code to test your plotting ability :)
so you can visit this link
http://code.google.com/p/gnuplot-cpp/source/browse/#svn%2Ftrunk
to see the header file "gnuplot_i.hpp" and source file "example.cc".
You will get many and many graphs, choose your appropriate graph, customize your core, and enjoy :)
If you're familiar with matplotlib, you can embed python in C/C++ applications. Depending on what you want it for, this might be a quick solution.
Chart Director has bindings for C++. I've used their .Net libraries, and I've been pretty happy with them. It's a pretty cheap library, and gives you the power to do all sorts of different charts.

Open source PDF library for C/C++ application? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?
I looked at the answers to this question, but they mostly relate to .Net.
LibHaru
Haru is a free, cross platform,
open-sourced software library for
generating PDF written in ANSI-C. It
can work as both a static-library (.a,
.lib) and a shared-library (.so,
.dll).
Didn't try it myself, but maybe it can help you
I worked on a project that required a pdf report. After searching for online I found the PoDoFo library. Seemed very robust. I did not need all the features, so I created a wrapper to abstract away some of the complexity. Wasn't too difficult. You can find the library here:
http://podofo.sourceforge.net/
Enjoy!
If you're brave and willing to roll your own, you could start with a PostScript library and augment it to deal with PDF, taking advantage of Adobe's free online PDF reference.
jagpdf seems to be one of them. It is written in C++ but provides a C API.
It depends a bit on your needs. Some toolkits are better at drawing, others are better for writing text. Cairo has a pretty good for drawing (it support a wide range of screen and file types, including pdf), but it may not be ideal for good typography.
PDF Hummus.
see for http://pdfhummus.com/ - contains all required features for manipulation with PDF files except rendering.
LibHaru seems to be used by many.
A non-open source approach is: PDF Creator Pilot which provides more language options including C++, C#, Delphi, ASP, ASP.NET, VB, VB.NET, VBScript, PHP and Python
muPdf library looks very promising: http://mupdf.com/
There is also an open source viewer: http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html
Try wkhtmltopdf
Software features
Cross platform.
Open source.
Convert any web pages into PDF documents using webkit.
You can add headers and footers.
TOC generation.
Batch mode conversions.
Can run on Linux server with an XServer (the X11 client libs must be installed).
Can be directly used by PHP or Python via bindings to libwkhtmltox.
http://wxcode.sourceforge.net/docs/wxpdfdoc/
Works with the wxWidgets library.