Author Topic: nPDF - A document viewer for the Nspire  (Read 237474 times)

0 Members and 1 Guest are viewing this topic.

Offline Roondak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 54
  • Rating: +4/-3
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #15 on: February 18, 2014, 10:24:30 pm »
Here are some planned features (in no particular order):
Proper error handling (using MuPDF's C exception handling system)
Zooming
A menu
Allowing the holding down of arrow keys
Find
Rotate page
Some convenient keyboard shortcuts (with help)
Select/copy/paste text (using the Nspire clipboard, i think nTxt has such a feature)

Feel free to post additional suggestions here.
Sounds great, can't wait for your next update! Also, could it have an easy way of going to a certain page? Like instantly getting to page 48 of the Nspire manual, for example.

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #16 on: February 18, 2014, 10:25:34 pm »
Yes, I'll probably add that to the menu (but I need to make one first) and a keyboard shortcut.

Also I need to reduce the filesize. It is slowing down my workflow because it takes forever to send the file to nspire_emu.
« Last Edit: February 18, 2014, 10:26:31 pm by Legimet »

Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #17 on: February 26, 2014, 09:59:11 am »
Can't wait for the next update! I suggest to add page up/page down and to enable the scrolling with the touchpad.



Offline blauemauritius

  • LV2 Member (Next: 40)
  • **
  • Posts: 25
  • Rating: +0/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #18 on: March 07, 2014, 09:58:11 pm »
Hi! I have tried to develop your version, but if i compile it, i got the error that the file "Memory.h" doesn't exist. Maybe a library is missing. Could you please help?

Thank you very much in advance!

Frank

Offline joeym

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #19 on: March 27, 2014, 09:45:37 pm »
How is the progress on this coming along?

This will be an essential program for all owners of the Nspire. Keep at it we really need this.

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: nPDF - A document viewer for the Nspire
« Reply #20 on: March 28, 2014, 04:24:00 am »
You allready have a working PDF solution, joeym, with mViewer GX:
http://tiplanet.org/forum/editgx.php
TI-Planet co-admin.

Offline joeym

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #21 on: March 29, 2014, 07:26:46 pm »
Hi Critor,

Does it work if the PDF is just an image? I tried it but did not have success.

I wish there was some sort of documentation or explanation regarding how to use it. In my opinion it is not very straight forward.

What exactly does the Apply button do? Do I use Apply before hitting the Download button?

Once I logged into TI-Planet I filled in the Filename field and description field. I then browsed my machine to where the .pdf was located. I left Lua selected and then I hit the Apply button.

In the bottom left corner of my browser it says "Sending request to tiplanet.org..."

I have tried this quite a few times and it seems to timeout.

Does this mean to not hit the Apply button and instead hit the Download button?

Why is there a File 1 area on the page and a File 2 area? Please explain how to use it. What is the difference between File 1 and File 2? I am a non-French speaker.

I apologize if you think it is intuitive. I just do not seem to follow how to use it.

Thank you in advance.

Offline joeym

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #22 on: March 30, 2014, 12:01:50 am »
Forget it Critor...I figured it out. It turns out it was pretty straight forward :) I was able to convert a .pdf for my Nspire.

But I am wondering if the pdf file is just an image if it still works?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #23 on: March 30, 2014, 03:07:06 am »
Nice to see your issue solved but please do not double post. ;)

Offline quadratic77

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 16
  • Rating: +0/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #24 on: May 07, 2014, 11:12:17 am »
Hello,

On my nspire CX CAS with ndless 3.6 and OS 3.6.0.546, when I run nPDF it runs fine the first time and freezes up the second time I try to run it. It freezes after about 10 seconds of the clock turning.

Could this be because of ndless 3.6 and nPDF uses 3.1 stuff (hooks, etc.)?

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #25 on: July 02, 2014, 09:40:08 pm »
OK, I completely rewrote nPDF from scratch in C++ over the past few weeks, and I have now released nPDF 0.2.This release is much more stable and supports zooming and proper scrolling. It also uses MuPDF 1.5 which is faster. Next I'll add some keyboard shortcuts.

Source code is now on GitHub.

Binary: https://legimet.github.io/nPDF-0.2.7z
Source tarball: https://legimet.github.io/nPDF-0.2-src.tar.bz2

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #26 on: July 03, 2014, 05:52:12 am »
Looks good! How's the speed like now? I can't test it myself until I'm at home..

However, I noticed, you're using nspire-ld for linking, which outputs ELF files and the attached binary is a bFLT file  ???

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #27 on: July 03, 2014, 08:49:13 am »
Cool to have you back Legimet ! :D Nice update too, never tried either version but I definitely should.

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #28 on: July 03, 2014, 09:09:01 am »
However, I noticed, you're using nspire-ld for linking, which outputs ELF files and the attached binary is a bFLT file  ???

I'm using an old commit of your Ndless fork. Do you think I should use Zehn by concatenating to the resources-loader? And can you add memory.h? It should just #include string.h.

Cool to have you back Legimet ! :D Nice update too, never tried either version but I definitely should.
Please don't try the old version :P It was a piece of junk, mostly copypasta'd from MuPDF example code. This version is actually usable and doesn't crash your calc. Also, I reduced the size by using a few macros that MuPDF lets you define to compile some fonts out.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nPDF - A document viewer for the Nspire
« Reply #29 on: July 03, 2014, 10:27:17 am »
However, I noticed, you're using nspire-ld for linking, which outputs ELF files and the attached binary is a bFLT file  ???

I'm using an old commit of your Ndless fork.
In your README.md is written:
Code: [Select]
Use Fabian Vogt's fork of Ndless, commit  ac7576f9cc2609789178270d86778a8e45b64464.which is the most recent commit.
Quote
Do you think I should use Zehn by concatenating to the resources-loader?
Exceptions will make your life much easier, and it will be a little bit faster (without -fPIE and -fPIC) ;)
There are two downsides though: Startup time will be a bit slower, the file would have to be loaded twice if .bss isn't included and debugging is only supported if you use Zehn without wrapper.
Of course you can simply elf2flt the generated .elf file, and you have both Zehn and bFLT :)

BTW: You can safely delete and delete[] nullptrs, so every if(ptr) delete ptr; is redundant.
Quote
And can you add memory.h? It should just #include string.h.
While you read this, it's already done :)

Edit: Some suggestions:
Code: [Select]
    void fillScreen(unsigned char c) {
for (int i = 0; i < SCREEN_WIDTH; i++) {
    for (int j = 0; j < SCREEN_WIDTH; j++) {
setPixel(c, i, j);
    }
}
    }
    void fillScreen(unsigned char r, unsigned char g, unsigned char b) {
for (int i = 0; i < SCREEN_WIDTH; i++) {
    for (int j = 0; j < SCREEN_WIDTH; j++) {
setPixel(r, g, b, i, j);
    }
}
    }
what about std::fill with custom pattern?

Code: [Select]
void setPixel(unsigned char c, int x, int y) {
// On color models, each pixel is represented in 16-bit high color
// On classic models, each pixel is 4 bits grayscale, 0 is black and 15 is white
if (0 <= x && x < SCREEN_WIDTH && 0 <= y && y < SCREEN_HEIGHT) {
    int pos = y * SCREEN_WIDTH + x;
Simple trick to increase performance sigificantly:
"unsigned int x, unsigned int y" obsoletes the comparision "0 <= x".

Code: [Select]
bool init() {
buf[0] = new unsigned char[SCREEN_BYTES_SIZE];
buf[1] = origBuf;
if (buf[0]) {
    if (std::atexit(deinit)) {
deinit();
return false;
    } else {
atexitCalled = true;
return true;
    }
} else {
    return false;
}
    }
Ever heard of global variables? (std::vector could work, too) :P
« Last Edit: July 03, 2014, 10:33:32 am by Vogtinator »