gpt4 book ai didi

javascript - 适用于 xcode 的 iphone 和 ipad epub 阅读器

转载 作者:太空宇宙 更新时间:2023-11-04 16:29:20 26 4
gpt4 key购买 nike

 I have done the followings in objective c and javascript,

1. extract the epub file using unzip library.
2. parse the .opf file to get the .xhtml files .
3. Using navigation tab i have display the contents like plain text .
4. Each page javascript to display contents in page by page to the html.
5. i finished the page flip also works fine.

I have to implement the followings,

1.Apply CSS to the html contents like iBooks

任何人都知道如何将 css 应用于显示的内容。我已经尝试了一个星期到现在我没有得到解决方案。

 Thanks in Advance,

此致, 苏雷什.M

最佳答案

你可以尝试这样的事情:

    NSString *varMySheet = @"var mySheet = document.styleSheets[0];";

NSString *addCSSRule = @"function addCSSRule(selector, newRule) {"
"if (mySheet.addRule) {"
"mySheet.addRule(selector, newRule);" // For Internet Explorer
"} else {"
"ruleIndex = mySheet.cssRules.length;"
"mySheet.insertRule(selector + '{' + newRule + ';}', ruleIndex);" // For Firefox, Chrome, etc.
"}"
"}";

// NSLog(@"w:%f h:%f", webView.bounds.size.width, webView.bounds.size.height);

NSString *insertRule1 = [NSString stringWithFormat:@"addCSSRule('html', 'padding: 0px; height: %fpx; -webkit-column-gap: 0px; -webkit-column-width: %fpx;')", webView.frame.size.height, webView.frame.size.width];
NSString *insertRule2 = [NSString stringWithFormat:@"addCSSRule('p', 'text-align: justify;')"];
NSString *setTextSizeRule = [NSString stringWithFormat:@"addCSSRule('body', '-webkit-text-size-adjust: %d%%;')",fontPercentSize];

我从 AePubReader 获得代码...作者:Federico Frappi

干杯!

关于javascript - 适用于 xcode 的 iphone 和 ipad epub 阅读器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4965845/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com