資源簡介
libharu 寫PDF 開源 C C++ 庫,我已經使用VS2010編譯過了,可以直接使用。也可以調試學習。
代碼片段和文件信息
/*
?*?<>?--?arc_demo.c
?*
?*?Copyright?(c)?1999-2006?Takeshi?Kanno?
?*
?*?Permission?to?use?copy?modify?distribute?and?sell?this?software
?*?and?its?documentation?for?any?purpose?is?hereby?granted?without?fee
?*?provided?that?the?above?copyright?notice?appear?in?all?copies?and
?*?that?both?that?copyright?notice?and?this?permission?notice?appear
?*?in?supporting?documentation.
?*?It?is?provided?“as?is“?without?express?or?implied?warranty.
?*
?*/
#include?
#include?
#include?
#include?
#include?“hpdf.h“
#include?“grid_sheet.h“
jmp_buf?env;
#ifdef?HPDF_DLL
void??__stdcall
#else
void
#endif
error_handler??(HPDF_STATUS???error_no
????????????????HPDF_STATUS???detail_no
????????????????void?????????*user_data)
{
????printf?(“ERROR:?error_no=%04X?detail_no=%u\n“?(HPDF_UINT)error_no
????????????????(HPDF_UINT)detail_no);
????longjmp(env?1);
}
int
main?(int?argc?char?**argv)
{
????HPDF_Doc??pdf;
????HPDF_Page?page;
????char?fname[256];
????HPDF_Point?pos;
????strcpy?(fname?argv[0]);
????strcat?(fname?“.pdf“);
????pdf?=?HPDF_New?(error_handler?NULL);
????if?(!pdf)?{
????????printf?(“error:?cannot?create?PdfDoc?object\n“);
????????return?1;
????}
????if?(setjmp(env))?{
????????HPDF_Free?(pdf);
????????return?1;
????}
????/*?add?a?new?page?object.?*/
????page?=?HPDF_AddPage?(pdf);
????HPDF_Page_SetHeight?(page?220);
????HPDF_Page_SetWidth?(page?200);
????/*?draw?grid?to?the?page?*/
????print_grid??(pdf?page);
????/*?draw?pie?chart
?????*
?????*???A:?45%?Red
?????*???B:?25%?Blue
?????*???C:?15%?green
?????*???D:?other?yellow
?????*/
????/*?A?*/
????HPDF_Page_SetRGBFill?(page?1.0?0?0);
????HPDF_Page_MoveTo?(page?100?100);
????HPDF_Page_LineTo?(page?100?180);
????HPDF_Page_Arc?(page?100?100?80?0?360?*?0.45);
????pos?=?HPDF_Page_GetCurrentPos?(page);
????HPDF_Page_LineTo?(page?100?100);
????HPDF_Page_Fill?(page);
????/*?B?*/
????HPDF_Page_SetRGBFill?(page?0?0?1.0);
????HPDF_Page_MoveTo?(page?100?100);
????HPDF_Page_LineTo?(page?pos.x?pos.y);
????HPDF_Page_Arc?(page?100?100?80?360?*?0.45?360?*?0.7);
????pos?=?HPDF_Page_GetCurrentPos?(page);
????HPDF_Page_LineTo?(page?100?100);
????HPDF_Page_Fill?(page);
????/*?C?*/
????HPDF_Page_SetRGBFill?(page?0?1.0?0);
????HPDF_Page_MoveTo?(page?100?100);
????HPDF_Page_LineTo?(page?pos.x?pos.y);
????HPDF_Page_Arc?(page?100?100?80?360?*?0.7?360?*?0.85);
????pos?=?HPDF_Page_GetCurrentPos?(page);
????HPDF_Page_LineTo?(page?100?100);
????HPDF_Page_Fill?(page);
????/*?D?*/
????HPDF_Page_SetRGBFill?(page?1.0?1.0?0);
????HPDF_Page_MoveTo?(page?100?100);
????HPDF_Page_LineTo?(page?pos.x?pos.y);
????HPDF_Page_Arc?(page?100?100?80?360?*?0.85?360);
????pos?=?HPDF_Page_GetCurrentPos?(page);
????HPDF_Page_LineTo?(page?100?100);
????HPDF_Page_Fill
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????145920??2014-09-12?16:37??Test_PDF\lib\libpng.dll
?????文件??????55614??2014-09-12?16:37??Test_PDF\lib\libpng.lib
?????文件?????320000??2014-09-10?21:16??Test_PDF\lib\libpngd.dll
?????文件??????55822??2014-09-10?21:16??Test_PDF\lib\libpngd.lib
?????文件??????65536??2014-09-12?16:37??Test_PDF\lib\zlib.dll
?????文件??????15582??2014-09-12?16:37??Test_PDF\lib\zlib.lib
?????文件?????145920??2014-09-10?21:16??Test_PDF\lib\zlibd.dll
?????文件??????15658??2014-09-10?21:16??Test_PDF\lib\zlibd.lib
?????文件????????345??2014-09-15?11:13??Test_PDF\libharu\.git\config
?????文件?????????73??2014-09-15?11:10??Test_PDF\libharu\.git\desc
?????文件?????????23??2014-09-15?11:13??Test_PDF\libharu\.git\HEAD
?????文件????????452??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\applypatch-msg.sample
?????文件????????896??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\commit-msg.sample
?????文件????????160??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\post-commit.sample
?????文件????????552??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\post-receive.sample
?????文件????????189??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\post-update.sample
?????文件????????398??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\pre-applypatch.sample
?????文件???????1704??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\pre-commit.sample
?????文件???????1348??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\pre-push.sample
?????文件???????4951??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\pre-reba
?????文件???????1239??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\prepare-commit-msg.sample
?????文件???????3611??2014-09-15?11:10??Test_PDF\libharu\.git\hooks\update.sample
?????文件??????27432??2014-09-15?11:13??Test_PDF\libharu\.git\index
?????文件????????240??2014-09-15?11:10??Test_PDF\libharu\.git\info\exclude
?????文件????????183??2014-09-15?11:13??Test_PDF\libharu\.git\logs\HEAD
?????文件????????183??2014-09-15?11:13??Test_PDF\libharu\.git\logs\refs\heads\master
?????文件????????183??2014-09-15?11:13??Test_PDF\libharu\.git\logs\refs\remotes\origin\HEAD
?????文件??????57576??2014-09-15?11:13??Test_PDF\libharu\.git\ob
?????文件???29982048??2014-09-15?11:13??Test_PDF\libharu\.git\ob
?????文件????????706??2014-09-15?11:13??Test_PDF\libharu\.git\packed-refs
............此處省略696個文件信息
評論
共有 條評論