NeoSmartpen / Ncode-SDK2.0

Ncode™ Generation SDK 2.0
17 stars 5 forks source link

Page Size not correct. Pen is partly offscreen. Some areas in the middle are only badly recognized. #9

Closed Belisarith closed 4 years ago

Belisarith commented 4 years ago

I've got a problem with the C# examples. Because I not yet have the possibility to test the datalogics example, please see #8 , I tried different methods:

  1. I found a quite promising PDF creator library with the name PDFSharp https://github.com/empira/PDFsharp. This library might also be an interesting alternative for datalogics as it is under MIT license and free.
  2. I tried the img2pdf python version, which is able to create lossless pdf reprentations of pngs. https://gitlab.mister-muffin.de/josch/img2pdf

With both ways I was able to create PDFs from the png generated in the sampleApp(NCode), which also were recognized by NeoNotes. I chose section 3 - N3C6. I tried dot and line stile as well. I tried 1200 and 600 dpi. However, every time the issue remains, that the pages generated are recognized with wrong sizes by NeoNotes. NeoNotes even thinks some lines are off the page. Other lines are not recognized at all. I expect the issue, is not with NeoNotes. Some areas in the middle are recognized better then others. The issue should not be related to my printer, as I have no problems with the notebooks from the NeoSmartPen webpage. Is this maybe a purposedly included problem with the trial appKey or am I missing something. Maybe the pictures below explain my problem in more detail. If necessary I can upload my code to github.

One example PDF is found here: https://github.com/Belisarith/smartpen/blob/master/HelloWorld.pdf And the png which was the basis of the pdf: https://github.com/Belisarith/smartpen/blob/master/3_27_524_0_8%2C27_11%2C7.png

The printed out pdf (blank) image

Making some markings image

The Page recognized by NeoNotes (ScreenShot - Please note lines are partly Off-Page) image

(Exported Image by NeoNotes) Unknown_0

hrhwang commented 4 years ago

I'm really sorry for the late reply. I also tried to use the PDFSharp library. However, I could not use it because of the blurring of the dots when zoomed in. Perhaps the pen will recognize it, but it will miss some strokes.

If you don't print at the actual size when you print, the app may stroke out of the screen. This part requires me to check in detail.

Please send me the signed dll folder of the Datalogigs library you are using. (hrhwang@neolab.net) I will build a new dll for you.

PDFSharp

Belisarith commented 4 years ago

I'm really sorry for the late reply.

No problem at all. Thank you for your effort.

Could you explain in more detail, what you mean with printing actual size? I used A4 format as the output for the dots and also as the print out to my printer. I see what you mean by blurry dots, I think PDFSharp may not be sufficient for the task. I get that the pen might not actually get all points because of a blurry image. But the offscreen printing is odd, see attached PDF. Is it a problem of my printer settings or already when generating the PDF? I also attached the code (which is really hacky) because of I wanted to just give it a first try.

I will send you the datalogics library I am using via mail. Best regards, Johannes Franz. HelloWorld.pdf sampleApp(Ncode).zip

hrhwang commented 4 years ago

I'm really sorry for the late reply.

No problem at all. Thank you for your effort.

Could you explain in more detail, what you mean with printing actual size? I used A4 format as the output for the dots and also as the print out to my printer. I see what you mean by blurry dots, I think PDFSharp may not be sufficient for the task. I get that the pen might not actually get all points because of a blurry image. But the offscreen printing is odd, see attached PDF. Is it a problem of my printer settings or already when generating the PDF? I also attached the code (which is really hacky) because of I wanted to just give it a first try.

I will send you the datalogics library I am using via mail. Best regards, Johannes Franz. HelloWorld.pdf sampleApp(Ncode).zip

hrhwang commented 4 years ago

Please try updated dll file. (v.2.2.15914.15046)

Belisarith commented 4 years ago

Dear HrHwang, the new version you send me works. Therefore, I now can use the datalogics.dlls. However, the problem with the offscreen recognition still remains. It just seems that somehow everything is moved to the right. There is recognition on the right side (outside of the paper) but very poor (up to nothing) of recognition on the left side. This strikes me as odd due to the following reasons:

  1. I did not change anything in your sample application, which to my understanding is exactly right for A4. I did prepare a abritary PDF file in A4 format as the "input_sample.pdf", please see attached file. And just ran the code.

  2. I do not see that this could be a problem with my printer, because when using the paper from your website and print it, I do not have any problems with the paper, i.e. this link

Do you have any suggestions? output.pdf input_sample.pdf

Belisarith commented 4 years ago

Okay, I did some further tests. My main conclusion is: Something is wrong with the generated ncode image. When I use to autogenerate the ncode image via the api in the example app, I always get issues with offscreen recognition and furthermore really bad recognition in the left parts of the screen. Please see the attached files, do you get better results with the image attached? 3_27_524_0_8,27_11,7 input_sample.pdf output.pdf

The reason I think I can exclude my printer and other issues, is the following:

  1. I downloaded the free notebooks provided by NeoLabs from the following link: Free A4 Notebook
  2. Then I extracted page number 1 and created a high resolution png from it.
  3. I set down the bitlevel to 1 with irfanview.
  4. This png I used instead the ncode image generated by the ncode sdk. The rest of the code I left ontouched. (I only changed the dpi conversion from 72/600 to 72/1200 as the image I extracted from the pdf is 1200 dpi).

The files I used are the following:

  1. Image created from free notebook page
  2. input_sample_letter.pdf Please note as the format of the free notebooks is in reality letter and not A4, I created another input pdf in letter size.

The resulting pdf is: output.pdf

With this pdf recognition works great also in the left area and there are no more issues with offscreen recognition. By this test I come to the conclusion that the problem lies with the image generated by the NCode SDK. Because of the reasons described the SDK is at the moment pretty much unusable for me. Especially due to the bad recognition in the left area.

I think the tests are pretty conclusive, however I am happy to supply more explanations, although I pretty much tested everything so far. Could you follow my description?

hrhwang commented 4 years ago

Thank you very much for telling me good comments. I printed both a PDF on a web page and a PDF created with the Ncode SDK(You send me), but it didn't make any difference on our printers. Actually, PDFs in web pages and PDFs created with the Ncode SDK are using different PDF engines. (We have contracted with another PDF engine developer.) It seems to make a slight difference. In the Ncode SDK you can create 2x2 dot code instead (not 3 dot code). The 2x2 dot code used to be the most recognized on office printers. Please try the following code.

sdk.SetDotType (true); // set true sdk.GetImage (codeData [i], 600, outputFilename, true); // set true

I will take a look at what you said and see if there is room for improvement.

atiqq122 commented 3 years ago

How to give existing pdf as input In the code.