News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Export C source as HTML or PDF file

Started by Pelle, March 16, 2005, 07:34:45 PM

Previous topic - Next topic

JohnF

Quote from: "Robert"Hi John:

Yes, go ahead, I have no objections.

Robert Wishlaw

Thanks.

John

Freddy

Hi Pelle!
When I try to compile this ADDIN using Pelles C 5.0 BETA I get the following error:
Quote
Building Export.obj.
C:\Arquivos de programas\PellesC\Include\addin.h(987): warning #2099: Missing type specifier.
C:\Arquivos de programas\PellesC\Include\addin.h(987): error #2001: Syntax error: expected ';' but found 'ADDIN_FIND_IN_FILES'.
C:\Arquivos de programas\PellesC\Include\addin.h(987): warning #2099: Missing type specifier.
*** Error code: 1 ***
Done.

I guess there is a little bug in addin.h?

Thanks

TimoVJL

#17
Updated to support form feed / page break too and RTF.

EDIT 2013-10-09: fix for CRLF (for Win7 WordPad?)
EDIT 2014-02-01: fix RTF font name.
May the source be with you

Robert

Hi Timovjl:

Thank you for the update.

Robert Wishlaw

John Z

#19
Looking for some information on creating PDF files I found an old add-in project created by multiple authors Pelle, Timo, and Robert, way back in 2005 for Pelles C version 3 (I think), then updated and added RTF by Timo in 2013.  https://forum.pellesc.de/index.php?topic=471.15

Of course it no longer worked with the newer version of Pelle C version 13.00.9 - Soooo I've minimally hacked it to get it functional for the current version.  While it will now work with plain text, UTF-8, and UTF-16 source pages it will only accurately produce output if the text code point is within the ANSI space.  This is OK for source code but some comments won't be displayed correctly when non-ANSI characters are used.  Could be fixed too but not sure it would be worth the effort.

Project ZIP include everything for a 64 bit version.

John Z

Robert

Quote from: John Z on January 15, 2026, 12:26:58 PMLooking for some information on creating PDF files I found an old add-in project created by multiple authors Pelle, Timo, and Robert, way back in 2005 for Pelles C version 3 (I think), then updated and added RTF by Timo in 2013.  https://forum.pellesc.de/index.php?topic=471.15

Of course it no longer worked with the newer version of Pelle C version 13.00.9 - Soooo I've minimally hacked it to get it functional for the current version.  While it will now work with plain text, UTF-8, and UTF-16 source pages it will only accurately produce output if the text code point is within the ANSI space.  This is OK for source code but some comments won't be displayed correctly when non-ANSI characters are used.  Could be fixed too but not sure it would be worth the effort.

Project ZIP include everything for a 64 bit version.

John Z

Hi John Z:

Wow! This takes me back to the "Realm of Long Long Ago".

About the HTML Export for UTF-8:
1. The HTML header requires more info for the page to render properly.
2. I think _setmode has to be used to get proper UTF-8 output. For details see
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode?view=msvc-170

Where can I get a zlib64.lib ?
Building Export64.dll.
POLINK: fatal error: File not found: 'zlib64.lib'.
*** Error code: 1 ***

Interesting.
Thanks.


John Z

#21
Hi Robert,

My apologizes, I didn't check that the project zip was complete.  I updated the post with a project zip that includes the libs. 

I'll look further into it (UTF-8) with the link you provided.

Hopefully good memories for you :)

John Z

Robert

Quote from: John Z on Yesterday at 11:45:34 AMHi Robert,

My apologizes, I didn't check that the project zip was complete.  I updated the post with a project zip that includes the libs. 

I'll look further into it (UTF-8) with the link you provided.

Hopefully good memories for you :)

John Z

Hi John Z:

Thanks, the zlib64 is good. Export is as expected with the limitations you have mentioned regarding UTF-8.

There is a separate but maybe connected problem with Pelles poide.exe IDE.

This code


#include <stdio.h>

/* entry point */
int main(void)
{
  printf("Hello, world!\n");
 
  return 0;
}


amended by adding a print in Tajik UTF-8


#include <stdio.h>

/* entry point */
int main(void)
{
  printf("Hello, world!\n");
  printf("Салом Ҷаҳон!\n");
 
  return 0;
}


is reloaded to the poide.exe IDE as


#include <stdio.h>

/* entry point */
int main(void)
{
  printf("Hello, world!\n");
  printf("????? ?????!!\n");
 
  return 0;
}


when the IDE is shut down and restarted.

TimoVJL

#23
zlib 1.3.1 project with missing header file, that dependecies forgot.

zlib 1.3.1 Release Notes
May the source be with you

Robert

Quote from: TimoVJL on Yesterday at 06:34:08 PMzlib 1.3.1 project with missing header file, that dependecies forgot.

zlib 1.3.1 Release Notes

Thanks Timo  8)

Robert

Hi John Z:

Very complex, very interesting.

I have had a look at Pelles and Timo's code comparing it with yours and have some ideas.

I will continue studying this and if I can get it to spit out anything intelligible, I'll let you know.


Robert

Hi John Z:

Yeah, well, uh ... we've got a bit of work in front of us if we hope to deal properly with non ASCII code.

This code


#include <windows.h>
#include <stdio.h>

static int OrigCodePage;
static const char* σκατ;
static const char* δυσκατανοήτων;

int main(int argc, char* argv[])
{
    OrigCodePage = GetConsoleOutputCP();
    SetConsoleOutputCP(65001);
    σκατ = "σκατ doo, be, shoo, bop, ooh, dee, doo, sha-bam";
    δυσκατανοήτων = "δυσκατανοήτων difficult to understand";
    printf("%s%s%s\n", σκατ, " ", δυσκατανοήτων);
    _getch();
    SetConsoleOutputCP(OrigCodePage);
    return 1;
}


Exports from poide.exe IDE as HTML file:

#include <windows.h>
#include <stdio.h>

static int OrigCodePage;
static const char* УКБФ;
static const char* ДХУКБФБНПЎФЩН;

int main(int argc, char* argv[])
{
    OrigCodePage = GetConsoleOutputCP();
    SetConsoleOutputCP(65001);
    УКБФ = "УКБФ doo, be, shoo, bop, ooh, dee, doo, sha-bam";
    ДХУКБФБНПЎФЩН = "ДХУКБФБНПЎФЩН difficult to understand";
    printf("%s%s%s\n", УКБФ, " ", ДХУКБФБНПЎФЩН);
    _getch();
    SetConsoleOutputCP(OrigCodePage);
    return 1;
}


Pelles C project code in attached file Skat.zip

John Z

Hi Robert,

Enjoy  :)  -

Both HTML and PDF formats do support UTF-8, and PDF formats are amenable to UTF-16 and others.
HTML can support UTF-16 but it is 'strongly' discouraged in the HTML5 spec so UTF-8 is mainstream for HTML.

It seems the biggest challenge is UTF-8/16 in RTF. All UTF-8 characters must be encoded using the \un? format.

So it can work, I just did the minimum to get it 'working' again.

While typing I see an update posted. I'll look at it more it seems your focus is a console program and not a windows program?  If so somewhere I saw a full fledged console program for console unicode display - maybe I can find again ...

John Z

TimoVJL

A small stupid C to RTF project to RichEdit.

It can help to debug some code.
May the source be with you