fummicc1 / csv2img

csv to image / pdf converter using Swift

Home Page:https://fummicc1.github.io/csv2img/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[csv2img]: Customise colours and size of PDF

infinitepower18 opened this issue Β· comments

What is your new feature?

Hi, thanks for this package. I have tried it out with my app as it currently has a CSV export feature and also wanted to include the ability to export to PDF. This seems to do the job but have one request. Is it possible to customise the colours of the columns? I rather not have any colours and just a black font.

I am also looking for a way to customise the page size such as A4, letter rather than the size being just the table size.

It will be great if you can add these features. Thank you πŸ™‚

@infinitepower18
Thank you for your nice suggestion.

I linked 2 PRs which address this issue.

Could you take a look at them and try it on your application?


Sorry that I couldn't prepare well-documented codes but please update your codes base on the following sample codes. πŸ™

  • how to set font color:
        let exportable = try await csv.generate(
            fontSize: 12,
            exportType: exportType,
            style: .init(color: NSColor.systemPink.cgColor)
        ).base
  • how to set pdf output size (NOTE: fontSize will be ignored when set pdfMetadata):
        await csv.update(
            pdfMetadata: .init(
                size: .a4,
                orientation: .landscape
            )
        )

Hi, just gave it a try, looks good but I would prefer not to have the cells stretched out. Currently it looks like this:

Screenshot

Is it possible to have something like this? WIth table alignment starting from top left

screenshot2

absolutely! let me adress this later. πŸ™

Hi, I released v1.8.1 that fixes above issue. please check it from your side as well when you have spare time.

Only issue now is the last column looking a bit weird. Other than that, it's all good πŸ‘

Untitled

Also I'm not sure why my note has the quotation marks, the original CSV output doesn't do that.