LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-23-2013, 11:06 AM   #1
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
PDF preview for Tcl/Tk


I need a preview pane for PDF files in a Tcl/Tk application, but it seems I cannot find one.

I have found a DVI viewer, and PDF generation tools, but not a PDF viewer. Apparently the wrong way of Googling?

Bottom line I could start an external application to convert PDF -> JPG and display those images but I try to avoid that.

Note it is just for viewing, strictly read-only.

jlinkels
 
Old 05-23-2013, 11:53 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 10,482

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
gs?
 
Old 05-23-2013, 12:02 PM   #3
Janus_Hyperion
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372

Rep: Reputation: Disabled
Ghostscript viewer may be?
 
Old 05-24-2013, 11:23 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Original Poster
Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
Mentioning Ghostscript did help for defining better keys for Google. As it seems, the preferred way is to convert the PDF to an image which can be shown on a canvas. I had hoped this could be done without temporary files etc.

Thanks all.

jlinkels
 
Old 05-24-2013, 11:33 AM   #5
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,334

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362
Hi

I don't know tcl/tk at all, but if you can use regular libraries, you should check out libpoppler.

http://en.wikipedia.org/wiki/Poppler_%28software%29

Edit:
If it's a problem, you could also try pdftoppm from poppler-utils and pipe the result to some other viewer. Just turn of all compression, and it could be fast enough.

Last edited by Guttorm; 05-24-2013 at 11:55 AM.
 
Old 05-24-2013, 09:30 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Original Poster
Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
Tcl/Tk is a scripting language. When a function like viewing PDF's has to be implemented, one would write it in C and make the call available in Tcl. Tk is just the graphical framework.

When one would write the functions in C, libpoppler could have been used.

Unfortunately no-one had found the need to write this function. Maybe understandable as Tcl is considered old and outdated.

Although I don't even consider to write such functions your information is useful, thanks.

jlinkels
 
Old 08-29-2019, 05:33 PM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Original Poster
Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
I am necroposting in my own thread

It seems that finally an exact match to my requirements has been published. But only in 2016, so back in 2013 when I asked the question it was not there yet. It the mean time I had my application working with external conversion of PDF through GS into multiple JPG files which were all converted to Tk images. Very messy and slow, but it worked.

The correct solution is this:
https://wiki.tcl-lang.org/page/tclMuPdf

A Tcl/Tk interface to the muPDF package.

I did some quick rudimentary tests, and it seems to work very fast. Also the option to convert a PDF to pages and the pages into images, directly in Tcl/Tk is very elegant.

Since I am now developing another application it might take some time before I can actually rewrite my original application using the tclMuPDF package.

Comments from others who use it are appreciated.

jlinkels
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Little error (not harmful) exists in tcl.SlackBuild (source slackbuilds for Tcl) blancamolinos Slackware 3 01-14-2013 05:46 AM
pdf preview in nautilus aZZZ Linux - Desktop 2 09-27-2007 12:20 PM
searching for words in konqueror's .pdf-preview ungua Linux - Software 2 11-12-2006 01:35 PM
Cannot find Tcl dll ( Perl's Tcl bridge ) Xyem Linux - Software 2 08-08-2006 09:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration